| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 432df16 commit 9f2c4e1
21 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -363,6 +363,7 @@ std_instead_of_core = "warn" | |||
| 363 | 363 | tests_outside_test_module = "warn" | |
| 364 | 364 | ||
| 365 | 365 | # nursery lints to enforce gradually | |
| 366 | + collection_is_never_read = "warn" | ||
| 366 | 367 | debug_assert_with_mut_call = "warn" | |
| 367 | 368 | derive_partial_eq_without_eq = "warn" | |
| 368 | 369 | imprecise_flops = "warn" | |
@@ -376,6 +377,8 @@ search_is_some = "warn" | |||
| 376 | 377 | significant_drop_in_scrutinee = "warn" | |
| 377 | 378 | single_option_map = "warn" | |
| 378 | 379 | trait_duplication_in_bounds = "warn" | |
| 380 | + type_repetition_in_bounds = "warn" | ||
| 381 | + unnecessary_struct_initialization = "warn" | ||
| 379 | 382 | unused_peekable = "warn" | |
| 380 | 383 | unused_rounding = "warn" | |
| 381 | 384 | use_self = "warn" | |
@@ -387,8 +390,10 @@ checked_conversions = "warn" | |||
| 387 | 390 | cloned_instead_of_copied = "warn" | |
| 388 | 391 | collapsible_else_if = "warn" | |
| 389 | 392 | comparison_chain = "warn" | |
| 393 | + copy_iterator = "warn" | ||
| 390 | 394 | doc_link_with_quotes = "warn" | |
| 391 | 395 | duration_suboptimal_units = "warn" | |
| 396 | + elidable_lifetime_names = "warn" | ||
| 392 | 397 | enum_glob_use = "warn" | |
| 393 | 398 | explicit_deref_methods = "warn" | |
| 394 | 399 | explicit_into_iter_loop = "warn" | |
@@ -404,6 +409,7 @@ ip_constant = "warn" | |||
| 404 | 409 | iter_filter_is_ok = "warn" | |
| 405 | 410 | iter_filter_is_some = "warn" | |
| 406 | 411 | large_futures = "warn" | |
| 412 | + large_types_passed_by_value = "warn" | ||
| 407 | 413 | manual_instant_elapsed = "warn" | |
| 408 | 414 | manual_is_variant_and = "warn" | |
| 409 | 415 | map_unwrap_or = "warn" | |
@@ -421,7 +427,9 @@ range_plus_one = "warn" | |||
| 421 | 427 | redundant_else = "warn" | |
| 422 | 428 | ref_option = "warn" | |
| 423 | 429 | return_self_not_must_use = "warn" | |
| 430 | + same_functions_in_if_condition = "warn" | ||
| 424 | 431 | single_char_pattern = "warn" | |
| 432 | + trivially_copy_pass_by_ref = "warn" | ||
| 425 | 433 | unchecked_time_subtraction = "warn" | |
| 426 | 434 | uninlined_format_args = "warn" | |
| 427 | 435 | unnecessary_box_returns = "warn" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2091,7 +2091,7 @@ impl Compiler { | |||
| 2091 | 2091 | self.emit_resume_for_scope(CompilerScope::Module, 1); | |
| 2092 | 2092 | emit!(self, PseudoInstruction::AnnotationsPlaceholder); | |
| 2093 | 2093 | ||
| 2094 | - let (doc, statements) = split_doc_with_range(&body.body, &self.opts); | ||
| 2094 | + let (doc, statements) = split_doc_with_range(&body.body, self.opts); | ||
| 2095 | 2095 | let module_start_loc = self.module_start_location(&body.body); | |
| 2096 | 2096 | // Handle annotation bookkeeping before the docstring assignment, as | |
| 2097 | 2097 | // codegen_body() does after _PyCodegen_Module() inserts the prefix set. | |
@@ -3075,7 +3075,7 @@ impl Compiler { | |||
| 3075 | 3075 | } | |
| 3076 | 3076 | ast::Stmt::AugAssign(ast::StmtAugAssign { | |
| 3077 | 3077 | target, op, value, .. | |
| 3078 | - }) => self.compile_augassign(target, op, value)?, | ||
| 3078 | + }) => self.compile_augassign(target, *op, value)?, | ||
| 3079 | 3079 | ast::Stmt::AnnAssign(ast::StmtAnnAssign { | |
| 3080 | 3080 | target, | |
| 3081 | 3081 | annotation, | |
@@ -4294,7 +4294,7 @@ impl Compiler { | |||
| 4294 | 4294 | self.set_qualname(); | |
| 4295 | 4295 | ||
| 4296 | 4296 | // Handle docstring - store in co_consts[0] if present | |
| 4297 | - let (doc_info, body) = split_doc_with_range(body, &self.opts); | ||
| 4297 | + let (doc_info, body) = split_doc_with_range(body, self.opts); | ||
| 4298 | 4298 | let doc_str = doc_info.as_ref().map(|(doc, _)| doc); | |
| 4299 | 4299 | if let Some(doc) = &doc_str { | |
| 4300 | 4300 | // Docstring present: store in co_consts[0] and set HAS_DOCSTRING flag | |
@@ -5137,7 +5137,7 @@ impl Compiler { | |||
| 5137 | 5137 | self.code_stack.last_mut().unwrap().private = Some(name.to_owned()); | |
| 5138 | 5138 | ||
| 5139 | 5139 | // 2. Set up class namespace | |
| 5140 | - let (doc_str, body) = split_doc_with_range(body, &self.opts); | ||
| 5140 | + let (doc_str, body) = split_doc_with_range(body, self.opts); | ||
| 5141 | 5141 | let class_body_prefix_range = self.source_line_start_range(firstlineno); | |
| 5142 | 5142 | self.set_source_range(class_body_prefix_range); | |
| 5143 | 5143 | ||
@@ -7004,7 +7004,7 @@ impl Compiler { | |||
| 7004 | 7004 | } | |
| 7005 | 7005 | ||
| 7006 | 7006 | /// [CPython `compiler_addcompare`](https://github.com/python/cpython/blob/627894459a84be3488a1789919679c997056a03c/Python/compile.c#L2880-L2924) | |
| 7007 | - fn compile_addcompare(&mut self, op: &ast::CmpOp) { | ||
| 7007 | + fn compile_addcompare(&mut self, op: ast::CmpOp) { | ||
| 7008 | 7008 | match op { | |
| 7009 | 7009 | ast::CmpOp::Eq => emit!( | |
| 7010 | 7010 | self, | |
@@ -7096,7 +7096,7 @@ impl Compiler { | |||
| 7096 | 7096 | if mid_comparators.is_empty() { | |
| 7097 | 7097 | self.compile_expression(last_comparator)?; | |
| 7098 | 7098 | self.set_source_range(compare_range); | |
| 7099 | - self.compile_addcompare(last_op); | ||
| 7099 | + self.compile_addcompare(*last_op); | ||
| 7100 | 7100 | ||
| 7101 | 7101 | return Ok(()); | |
| 7102 | 7102 | } | |
@@ -7112,7 +7112,7 @@ impl Compiler { | |||
| 7112 | 7112 | emit!(self, Instruction::Swap { i: 2 }); | |
| 7113 | 7113 | emit!(self, Instruction::Copy { i: 2 }); | |
| 7114 | 7114 | ||
| 7115 | - self.compile_addcompare(op); | ||
| 7115 | + self.compile_addcompare(*op); | ||
| 7116 | 7116 | ||
| 7117 | 7117 | // if comparison result is false, we break with this value; if true, try the next one. | |
| 7118 | 7118 | emit!(self, Instruction::Copy { i: 1 }); | |
@@ -7123,7 +7123,7 @@ impl Compiler { | |||
| 7123 | 7123 | ||
| 7124 | 7124 | self.compile_expression(last_comparator)?; | |
| 7125 | 7125 | self.set_source_range(compare_range); | |
| 7126 | - self.compile_addcompare(last_op); | ||
| 7126 | + self.compile_addcompare(*last_op); | ||
| 7127 | 7127 | ||
| 7128 | 7128 | let end = self.new_block(); | |
| 7129 | 7129 | emit!(self, PseudoInstruction::JumpNoInterrupt { delta: end }); | |
@@ -7154,7 +7154,7 @@ impl Compiler { | |||
| 7154 | 7154 | self.compile_expression(left)?; | |
| 7155 | 7155 | self.compile_expression(last_comparator)?; | |
| 7156 | 7156 | self.set_source_range(compare_range); | |
| 7157 | - self.compile_addcompare(last_op); | ||
| 7157 | + self.compile_addcompare(*last_op); | ||
| 7158 | 7158 | self.emit_pop_jump_by_condition(condition, target_block); | |
| 7159 | 7159 | return Ok(()); | |
| 7160 | 7160 | } | |
@@ -7167,14 +7167,14 @@ impl Compiler { | |||
| 7167 | 7167 | self.set_source_range(compare_range); | |
| 7168 | 7168 | emit!(self, Instruction::Swap { i: 2 }); | |
| 7169 | 7169 | emit!(self, Instruction::Copy { i: 2 }); | |
| 7170 | - self.compile_addcompare(op); | ||
| 7170 | + self.compile_addcompare(*op); | ||
| 7171 | 7171 | emit!(self, Instruction::ToBool); | |
| 7172 | 7172 | emit!(self, Instruction::PopJumpIfFalse { delta: cleanup }); | |
| 7173 | 7173 | } | |
| 7174 | 7174 | ||
| 7175 | 7175 | self.compile_expression(last_comparator)?; | |
| 7176 | 7176 | self.set_source_range(compare_range); | |
| 7177 | - self.compile_addcompare(last_op); | ||
| 7177 | + self.compile_addcompare(*last_op); | ||
| 7178 | 7178 | emit!(self, Instruction::ToBool); | |
| 7179 | 7179 | self.emit_pop_jump_by_condition(condition, target_block); | |
| 7180 | 7180 | let end = self.new_block(); | |
@@ -7446,7 +7446,7 @@ impl Compiler { | |||
| 7446 | 7446 | fn compile_augassign( | |
| 7447 | 7447 | &mut self, | |
| 7448 | 7448 | target: &ast::Expr, | |
| 7449 | - op: &ast::Operator, | ||
| 7449 | + op: ast::Operator, | ||
| 7450 | 7450 | value: &ast::Expr, | |
| 7451 | 7451 | ) -> CompileResult<()> { | |
| 7452 | 7452 | let stmt_range = self.current_source_range; | |
@@ -7559,7 +7559,7 @@ impl Compiler { | |||
| 7559 | 7559 | Ok(()) | |
| 7560 | 7560 | } | |
| 7561 | 7561 | ||
| 7562 | - fn compile_op(&mut self, op: &ast::Operator, inplace: bool) { | ||
| 7562 | + fn compile_op(&mut self, op: ast::Operator, inplace: bool) { | ||
| 7563 | 7563 | let bin_op = match op { | |
| 7564 | 7564 | ast::Operator::Add => BinaryOperator::Add, | |
| 7565 | 7565 | ast::Operator::Sub => BinaryOperator::Subtract, | |
@@ -7687,7 +7687,7 @@ impl Compiler { | |||
| 7687 | 7687 | ||
| 7688 | 7688 | /// Compile a boolean operation as an expression. | |
| 7689 | 7689 | /// This means, that the last value remains on the stack. | |
| 7690 | - fn compile_bool_op(&mut self, op: &ast::BoolOp, values: &[ast::Expr]) -> CompileResult<()> { | ||
| 7690 | + fn compile_bool_op(&mut self, op: ast::BoolOp, values: &[ast::Expr]) -> CompileResult<()> { | ||
| 7691 | 7691 | let boolop_range = self.current_source_range; | |
| 7692 | 7692 | let after_block = self.new_block(); | |
| 7693 | 7693 | let (last_value, prefix_values) = values.split_last().unwrap(); | |
@@ -7707,7 +7707,7 @@ impl Compiler { | |||
| 7707 | 7707 | ||
| 7708 | 7708 | /// Emit CPython-style pseudo conditional jump for short-circuit evaluation. | |
| 7709 | 7709 | /// flowgraph.c lowers it to `COPY 1; TO_BOOL; POP_JUMP_IF_*`. | |
| 7710 | - fn emit_short_circuit_test(&mut self, op: &ast::BoolOp, target: BlockIdx) { | ||
| 7710 | + fn emit_short_circuit_test(&mut self, op: ast::BoolOp, target: BlockIdx) { | ||
| 7711 | 7711 | match op { | |
| 7712 | 7712 | ast::BoolOp::And => { | |
| 7713 | 7713 | emit!(self, PseudoInstruction::JumpIfFalse { delta: target }); | |
@@ -7962,7 +7962,7 @@ impl Compiler { | |||
| 7962 | 7962 | func, arguments, .. | |
| 7963 | 7963 | }) => self.compile_call(func, arguments)?, | |
| 7964 | 7964 | ast::Expr::BoolOp(ast::ExprBoolOp { op, values, .. }) => { | |
| 7965 | - self.compile_bool_op(op, values)? | ||
| 7965 | + self.compile_bool_op(*op, values)? | ||
| 7966 | 7966 | } | |
| 7967 | 7967 | ast::Expr::BinOp(ast::ExprBinOp { | |
| 7968 | 7968 | left, op, right, .. | |
@@ -7972,7 +7972,7 @@ impl Compiler { | |||
| 7972 | 7972 | ||
| 7973 | 7973 | // Restore full expression range before emitting the operation | |
| 7974 | 7974 | self.set_source_range(range); | |
| 7975 | - self.compile_op(op, false); | ||
| 7975 | + self.compile_op(*op, false); | ||
| 7976 | 7976 | } | |
| 7977 | 7977 | ast::Expr::Subscript(ast::ExprSubscript { | |
| 7978 | 7978 | value, slice, ctx, .. | |
@@ -12000,10 +12000,10 @@ fn expandtabs(input: &str, tab_size: usize) -> String { | |||
| 12000 | 12000 | expanded_str | |
| 12001 | 12001 | } | |
| 12002 | 12002 | ||
| 12003 | - fn split_doc_with_range<'a>( | ||
| 12004 | - body: &'a [ast::Stmt], | ||
| 12005 | - opts: &CompileOpts, | ||
| 12006 | - ) -> (Option<(String, TextRange)>, &'a [ast::Stmt]) { | ||
| 12003 | + fn split_doc_with_range( | ||
| 12004 | + body: &[ast::Stmt], | ||
| 12005 | + opts: CompileOpts, | ||
| 12006 | + ) -> (Option<(String, TextRange)>, &[ast::Stmt]) { | ||
| 12007 | 12007 | if let Some((ast::Stmt::Expr(expr), body_rest)) = body.split_first() { | |
| 12008 | 12008 | let doc_comment = match &*expr.value { | |
| 12009 | 12009 | ast::Expr::StringLiteral(value) => Some((&value.value, expr.value.range())), | |
@@ -12023,7 +12023,7 @@ fn split_doc_with_range<'a>( | |||
| 12023 | 12023 | } | |
| 12024 | 12024 | ||
| 12025 | 12025 | #[cfg(test)] | |
| 12026 | - fn split_doc<'a>(body: &'a [ast::Stmt], opts: &CompileOpts) -> (Option<String>, &'a [ast::Stmt]) { | ||
| 12026 | + fn split_doc(body: &[ast::Stmt], opts: CompileOpts) -> (Option<String>, &[ast::Stmt]) { | ||
| 12027 | 12027 | let (doc, body) = split_doc_with_range(body, opts); | |
| 12028 | 12028 | (doc.map(|(doc, _)| doc), body) | |
| 12029 | 12029 | } | |
@@ -12452,7 +12452,7 @@ def f(x, y, z): | |||
| 12452 | 12452 | in_async_scope: is_async, | |
| 12453 | 12453 | }; | |
| 12454 | 12454 | compiler.set_qualname(); | |
| 12455 | - let (_doc_str, body) = split_doc(body, &compiler.opts); | ||
| 12455 | + let (_doc_str, body) = split_doc(body, compiler.opts); | ||
| 12456 | 12456 | let start_label = compiler.use_cpython_function_start_label(); | |
| 12457 | 12457 | let is_gen = is_async || compiler.current_symbol_table().is_generator; | |
| 12458 | 12458 | let stop_iteration_block = if is_gen { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3291,9 +3291,9 @@ fn optimize_lists_and_sets( | |||
| 3291 | 3291 | const VISITED: i32 = -1; | |
| 3292 | 3292 | ||
| 3293 | 3293 | /// flowgraph.c SWAPPABLE | |
| 3294 | - fn is_swappable(instr: &AnyInstruction) -> bool { | ||
| 3294 | + fn is_swappable(instr: AnyInstruction) -> bool { | ||
| 3295 | 3295 | matches!( | |
| 3296 | - (*instr).into(), | ||
| 3296 | + instr.into(), | ||
| 3297 | 3297 | AnyOpcode::Real(Opcode::StoreFast | Opcode::PopTop) | |
| 3298 | 3298 | | AnyOpcode::Pseudo(PseudoOpcode::StoreFastMaybeNull) | |
| 3299 | 3299 | ) | |
@@ -3315,17 +3315,22 @@ fn next_swappable_instruction(block: &Block, mut i: usize, lineno: i32) -> Optio | |||
| 3315 | 3315 | if i >= block.instruction_used { | |
| 3316 | 3316 | return None; | |
| 3317 | 3317 | } | |
| 3318 | + | ||
| 3318 | 3319 | let info = &block.instructions[i]; | |
| 3319 | 3320 | let info_lineno = instruction_lineno(info); | |
| 3321 | + | ||
| 3320 | 3322 | if lineno >= 0 && info_lineno != lineno { | |
| 3321 | 3323 | return None; | |
| 3322 | 3324 | } | |
| 3325 | + | ||
| 3323 | 3326 | if matches!(info.instr, AnyInstruction::Real(Instruction::Nop)) { | |
| 3324 | 3327 | continue; | |
| 3325 | 3328 | } | |
| 3326 | - if is_swappable(&info.instr) { | ||
| 3329 | + | ||
| 3330 | + if is_swappable(info.instr) { | ||
| 3327 | 3331 | return Some(i); | |
| 3328 | 3332 | } | |
| 3333 | + | ||
| 3329 | 3334 | return None; | |
| 3330 | 3335 | } | |
| 3331 | 3336 | } | |
@@ -5440,7 +5445,7 @@ fn basicblock_add_jump( | |||
| 5440 | 5445 | } | |
| 5441 | 5446 | ||
| 5442 | 5447 | /// pycore_opcode_utils.h IS_CONDITIONAL_JUMP_OPCODE | |
| 5443 | - fn is_conditional_jump_opcode(instr: &AnyInstruction) -> bool { | ||
| 5448 | + fn is_conditional_jump_opcode(instr: AnyInstruction) -> bool { | ||
| 5444 | 5449 | matches!( | |
| 5445 | 5450 | instr.real().map(Into::into), | |
| 5446 | 5451 | Some( | |
@@ -5524,7 +5529,7 @@ fn normalize_jumps_in_block( | |||
| 5524 | 5529 | let Some(last_ins) = basicblock_last_instr(&blocks[idx]).copied() else { | |
| 5525 | 5530 | return Ok(()); | |
| 5526 | 5531 | }; | |
| 5527 | - if !is_conditional_jump_opcode(&last_ins.instr) { | ||
| 5532 | + if !is_conditional_jump_opcode(last_ins.instr) { | ||
| 5528 | 5533 | return Ok(()); | |
| 5529 | 5534 | } | |
| 5530 | 5535 | debug_assert!(!last_ins.instr.is_assembler()); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -141,15 +141,21 @@ impl FormatParse for FormatGrouping { | |||
| 141 | 141 | } | |
| 142 | 142 | } | |
| 143 | 143 | ||
| 144 | - impl From<&FormatGrouping> for char { | ||
| 145 | - fn from(fg: &FormatGrouping) -> Self { | ||
| 144 | + impl From<FormatGrouping> for char { | ||
| 145 | + fn from(fg: FormatGrouping) -> Self { | ||
| 146 | 146 | match fg { | |
| 147 | 147 | FormatGrouping::Comma => ',', | |
| 148 | 148 | FormatGrouping::Underscore => '_', | |
| 149 | 149 | } | |
| 150 | 150 | } | |
| 151 | 151 | } | |
| 152 | 152 | ||
| 153 | + impl From<&FormatGrouping> for char { | ||
| 154 | + fn from(fg: &FormatGrouping) -> Self { | ||
| 155 | + Self::from(*fg) | ||
| 156 | + } | ||
| 157 | + } | ||
| 158 | + | ||
| 153 | 159 | #[derive(Clone, Copy, Debug, PartialEq, Eq)] | |
| 154 | 160 | pub enum FormatType { | |
| 155 | 161 | String, | |
@@ -322,7 +328,7 @@ impl FormatSpec { | |||
| 322 | 328 | return Err(FormatSpecError::DecimalDigitsTooMany); | |
| 323 | 329 | } | |
| 324 | 330 | let (grouping_option, text) = FormatGrouping::parse(text); | |
| 325 | - if let Some(grouping) = &grouping_option { | ||
| 331 | + if let Some(grouping) = grouping_option { | ||
| 326 | 332 | Self::validate_separator(grouping, text)?; | |
| 327 | 333 | } | |
| 328 | 334 | let (precision, text) = parse_precision(text)?; | |
@@ -349,11 +355,12 @@ impl FormatSpec { | |||
| 349 | 355 | }) | |
| 350 | 356 | } | |
| 351 | 357 | ||
| 352 | - fn validate_separator(grouping: &FormatGrouping, text: &Wtf8) -> Result<(), FormatSpecError> { | ||
| 358 | + fn validate_separator(grouping: FormatGrouping, text: &Wtf8) -> Result<(), FormatSpecError> { | ||
| 353 | 359 | let mut chars = text.code_points().peekable(); | |
| 360 | + let grouping_char = char::from(grouping); | ||
| 354 | 361 | match chars.peek().and_then(|cp| CodePoint::to_char(*cp)) { | |
| 355 | 362 | Some(c) if c == ',' || c == '_' => { | |
| 356 | - if c == char::from(grouping) { | ||
| 363 | + if c == grouping_char { | ||
| 357 | 364 | Err(FormatSpecError::UnspecifiedFormat(c, c)) | |
| 358 | 365 | } else { | |
| 359 | 366 | Err(FormatSpecError::ExclusiveFormat(',', '_')) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -112,7 +112,7 @@ mod win { | |||
| 112 | 112 | } | |
| 113 | 113 | ||
| 114 | 114 | #[inline] | |
| 115 | - pub(super) fn as_raw_fd(&self) -> Raw { | ||
| 115 | + pub(super) fn as_raw_fd(self) -> Raw { | ||
| 116 | 116 | self.fd | |
| 117 | 117 | } | |
| 118 | 118 | } | |
@@ -140,12 +140,13 @@ pub struct Borrowed<'fd> { | |||
| 140 | 140 | inner: BorrowedInner<'fd>, | |
| 141 | 141 | } | |
| 142 | 142 | ||
| 143 | - impl<'fd> PartialEq for Borrowed<'fd> { | ||
| 143 | + impl PartialEq for Borrowed<'_> { | ||
| 144 | 144 | fn eq(&self, other: &Self) -> bool { | |
| 145 | 145 | self.as_raw() == other.as_raw() | |
| 146 | 146 | } | |
| 147 | 147 | } | |
| 148 | - impl<'fd> Eq for Borrowed<'fd> {} | ||
| 148 | + | ||
| 149 | + impl Eq for Borrowed<'_> {} | ||
| 149 | 150 | ||
| 150 | 151 | impl fmt::Debug for Borrowed<'_> { | |
| 151 | 152 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |
@@ -250,7 +251,7 @@ impl IntoRawFd for Owned { | |||
| 250 | 251 | } | |
| 251 | 252 | } | |
| 252 | 253 | ||
| 253 | - impl<'fd> Borrowed<'fd> { | ||
| 254 | + impl Borrowed<'_> { | ||
| 254 | 255 | /// Create a `crt_fd::Borrowed` from a raw file descriptor. | |
| 255 | 256 | /// | |
| 256 | 257 | /// # Safety | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -165,8 +165,8 @@ pub mod windows { | |||
| 165 | 165 | (time_out, nsec_out as _) | |
| 166 | 166 | } | |
| 167 | 167 | ||
| 168 | - fn file_time_to_time_t_nsec(in_ptr: &FILETIME) -> (libc::time_t, libc::c_int) { | ||
| 169 | - let in_val: i64 = unsafe { core::mem::transmute_copy(in_ptr) }; | ||
| 168 | + fn file_time_to_time_t_nsec(in_ptr: FILETIME) -> (libc::time_t, libc::c_int) { | ||
| 169 | + let in_val: i64 = unsafe { core::mem::transmute_copy(&in_ptr) }; | ||
| 170 | 170 | let nsec_out = (in_val % 10_000_000) * 100; // FILETIME is in units of 100 nsec. | |
| 171 | 171 | let time_out = (in_val / 10_000_000) - SECS_BETWEEN_EPOCHS; | |
| 172 | 172 | (time_out, nsec_out as _) | |
@@ -196,10 +196,10 @@ pub mod windows { | |||
| 196 | 196 | ) | |
| 197 | 197 | } else { | |
| 198 | 198 | ( | |
| 199 | - file_time_to_time_t_nsec(&info.ftCreationTime), | ||
| 199 | + file_time_to_time_t_nsec(info.ftCreationTime), | ||
| 200 | 200 | (0, 0), | |
| 201 | - file_time_to_time_t_nsec(&info.ftLastWriteTime), | ||
| 202 | - file_time_to_time_t_nsec(&info.ftLastAccessTime), | ||
| 201 | + file_time_to_time_t_nsec(info.ftLastWriteTime), | ||
| 202 | + file_time_to_time_t_nsec(info.ftLastAccessTime), | ||
| 203 | 203 | ) | |
| 204 | 204 | }; | |
| 205 | 205 | let st_nlink = info.nNumberOfLinks as i32; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments