| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -343,6 +343,13 @@ unnested_or_patterns = "warn" | |||
| 343 | 343 | ||
| 344 | 344 | # pedantic lints to enforce gradually | |
| 345 | 345 | cloned_instead_of_copied = "warn" | |
| 346 | + collapsible_else_if = "warn" | ||
| 347 | + comparison_chain = "warn" | ||
| 348 | + explicit_into_iter_loop = "warn" | ||
| 349 | + explicit_iter_loop = "warn" | ||
| 350 | + filter_map_next = "warn" | ||
| 351 | + flat_map_option = "warn" | ||
| 352 | + inconsistent_struct_constructor = "warn" | ||
| 346 | 353 | manual_is_variant_and = "warn" | |
| 347 | 354 | map_unwrap_or = "warn" | |
| 348 | 355 | must_use_candidate = "warn" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -823,7 +823,7 @@ impl Compiler { | |||
| 823 | 823 | } | |
| 824 | 824 | } | |
| 825 | 825 | ||
| 826 | - for elt in elts.iter() { | ||
| 826 | + for elt in elts { | ||
| 827 | 827 | if let ast::Expr::Starred(ast::ExprStarred { value, .. }) = elt { | |
| 828 | 828 | // When we hit first star, build sequence with elements so far | |
| 829 | 829 | if !sequence_built { | |
@@ -11509,7 +11509,7 @@ impl Compiler { | |||
| 11509 | 11509 | let mut current_string = Wtf8Buf::new(); | |
| 11510 | 11510 | let mut interp_count: u32 = 0; | |
| 11511 | 11511 | ||
| 11512 | - for tstring in tstring_value.iter() { | ||
| 11512 | + for tstring in tstring_value { | ||
| 11513 | 11513 | self.collect_tstring_strings( | |
| 11514 | 11514 | tstring, | |
| 11515 | 11515 | &mut all_strings, | |
@@ -11534,7 +11534,7 @@ impl Compiler { | |||
| 11534 | 11534 | } | |
| 11535 | 11535 | ); | |
| 11536 | 11536 | ||
| 11537 | - for tstring in tstring_value.iter() { | ||
| 11537 | + for tstring in tstring_value { | ||
| 11538 | 11538 | self.compile_tstring_interpolations(tstring)?; | |
| 11539 | 11539 | } | |
| 11540 | 11540 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -529,7 +529,7 @@ impl CodeInfo { | |||
| 529 | 529 | ||
| 530 | 530 | // Final DCE: truncate instructions after terminal ops in linearized blocks. | |
| 531 | 531 | // This catches dead code created by normalize_jumps after the initial DCE. | |
| 532 | - for block in blocks.iter_mut() { | ||
| 532 | + for block in &mut blocks { | ||
| 533 | 533 | if let Some(pos) = block | |
| 534 | 534 | .instructions | |
| 535 | 535 | .iter() | |
@@ -540,7 +540,7 @@ impl CodeInfo { | |||
| 540 | 540 | } | |
| 541 | 541 | ||
| 542 | 542 | // Pre-compute cache_entries for real (non-pseudo) instructions | |
| 543 | - for block in blocks.iter_mut() { | ||
| 543 | + for block in &mut blocks { | ||
| 544 | 544 | for instr in &mut block.instructions { | |
| 545 | 545 | if let AnyInstruction::Real(op) = instr.instr { | |
| 546 | 546 | instr.cache_entries = op.cache_entries() as u32; | |
@@ -9430,7 +9430,7 @@ impl CodeInfo { | |||
| 9430 | 9430 | ||
| 9431 | 9431 | // Fix up handler stack_depth in ExceptHandlerInfo using start_depths | |
| 9432 | 9432 | // computed above: depth = start_depth - 1 - preserve_lasti | |
| 9433 | - for block in self.blocks.iter_mut() { | ||
| 9433 | + for block in &mut self.blocks { | ||
| 9434 | 9434 | for ins in &mut block.instructions { | |
| 9435 | 9435 | if let Some(ref mut handler) = ins.except_handler { | |
| 9436 | 9436 | let h_start = start_depths[handler.handler_block.idx()]; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -652,7 +652,7 @@ impl CodeUnits { | |||
| 652 | 652 | /// Disable adaptive specialization by setting all counters to unreachable. | |
| 653 | 653 | /// Used for CPython-compiled bytecode where specialization may not be safe. | |
| 654 | 654 | pub fn disable_specialization(&self) { | |
| 655 | - for counter in self.adaptive_counters.iter() { | ||
| 655 | + for counter in &self.adaptive_counters { | ||
| 656 | 656 | counter.store(UNREACHABLE_BACKOFF, Ordering::Relaxed); | |
| 657 | 657 | } | |
| 658 | 658 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -928,13 +928,13 @@ pub fn serialize_code<W: Write, C: Constant>(buf: &mut W, code: &CodeObject<C>) | |||
| 928 | 928 | let total_lp_count = code.varnames.len() + cell_only_names.len() + code.freevars.len(); | |
| 929 | 929 | buf.write_u8(Type::Tuple as u8); | |
| 930 | 930 | write_len(buf, total_lp_count); | |
| 931 | - for n in code.varnames.iter() { | ||
| 931 | + for n in &code.varnames { | ||
| 932 | 932 | write_marshal_str(buf, n.as_ref()); | |
| 933 | 933 | } | |
| 934 | 934 | for &n in &cell_only_names { | |
| 935 | 935 | write_marshal_str(buf, n); | |
| 936 | 936 | } | |
| 937 | - for n in code.freevars.iter() { | ||
| 937 | + for n in &code.freevars { | ||
| 938 | 938 | write_marshal_str(buf, n.as_ref()); | |
| 939 | 939 | } | |
| 940 | 940 | // 10: co_localspluskinds — use the stored kinds directly | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -609,7 +609,7 @@ mod decl { | |||
| 609 | 609 | // Disable SIGSEGV handler for access violations to avoid double output | |
| 610 | 610 | if code == 0xC0000005 { | |
| 611 | 611 | unsafe { | |
| 612 | - for handler in FAULTHANDLER_HANDLERS.iter_mut() { | ||
| 612 | + for handler in &mut FAULTHANDLER_HANDLERS { | ||
| 613 | 613 | if handler.signum == libc::SIGSEGV { | |
| 614 | 614 | faulthandler_disable_fatal_handler(handler); | |
| 615 | 615 | break; | |
@@ -632,7 +632,7 @@ mod decl { | |||
| 632 | 632 | } | |
| 633 | 633 | ||
| 634 | 634 | unsafe { | |
| 635 | - for handler in FAULTHANDLER_HANDLERS.iter_mut() { | ||
| 635 | + for handler in &mut FAULTHANDLER_HANDLERS { | ||
| 636 | 636 | if handler.enabled { | |
| 637 | 637 | continue; | |
| 638 | 638 | } | |
@@ -661,7 +661,7 @@ mod decl { | |||
| 661 | 661 | } | |
| 662 | 662 | ||
| 663 | 663 | unsafe { | |
| 664 | - for handler in FAULTHANDLER_HANDLERS.iter_mut() { | ||
| 664 | + for handler in &mut FAULTHANDLER_HANDLERS { | ||
| 665 | 665 | if handler.enabled { | |
| 666 | 666 | continue; | |
| 667 | 667 | } | |
@@ -700,7 +700,7 @@ mod decl { | |||
| 700 | 700 | } | |
| 701 | 701 | ||
| 702 | 702 | unsafe { | |
| 703 | - for handler in FAULTHANDLER_HANDLERS.iter_mut() { | ||
| 703 | + for handler in &mut FAULTHANDLER_HANDLERS { | ||
| 704 | 704 | faulthandler_disable_fatal_handler(handler); | |
| 705 | 705 | } | |
| 706 | 706 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -473,7 +473,7 @@ pub(super) fn cert_der_to_dict_helper( | |||
| 473 | 473 | if let Some(ext) = ext_map.get(&OID_X509_EXT_CRL_DISTRIBUTION_POINTS) | |
| 474 | 474 | && let ParsedExtension::CRLDistributionPoints(cdp) = &ext.parsed_extension() | |
| 475 | 475 | { | |
| 476 | - for dp in cdp.points.iter() { | ||
| 476 | + for dp in &cdp.points { | ||
| 477 | 477 | if let Some(dist_point) = &dp.distribution_point { | |
| 478 | 478 | use x509_parser::extensions::DistributionPointName; | |
| 479 | 479 | if let DistributionPointName::FullName(names) = dist_point { | |
@@ -583,7 +583,7 @@ pub(super) fn build_verified_chain( | |||
| 583 | 583 | let issuer_name = last_cert.issuer(); | |
| 584 | 584 | let mut found_issuer = false; | |
| 585 | 585 | ||
| 586 | - for ca_der in ca_certs_der.iter() { | ||
| 586 | + for ca_der in ca_certs_der { | ||
| 587 | 587 | let (_, ca_cert) = match X509Certificate::from_der(ca_der) { | |
| 588 | 588 | Ok(parsed) => parsed, | |
| 589 | 589 | Err(_) => continue, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -99,7 +99,7 @@ impl Initializer for PyNamespace { | |||
| 99 | 99 | }; | |
| 100 | 100 | ||
| 101 | 101 | // Validate keys are strings and set attributes | |
| 102 | - for (key, value) in dict.into_iter() { | ||
| 102 | + for (key, value) in dict { | ||
| 103 | 103 | let key_str = key | |
| 104 | 104 | .downcast_ref::<crate::builtins::PyStr>() | |
| 105 | 105 | .ok_or_else(|| { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -55,7 +55,7 @@ impl Constructor for PyTemplate { | |||
| 55 | 55 | let mut interpolations: Vec<PyObjectRef> = Vec::new(); | |
| 56 | 56 | let mut last_was_str = false; | |
| 57 | 57 | ||
| 58 | - for item in args.args.iter() { | ||
| 58 | + for item in &args.args { | ||
| 59 | 59 | if let Ok(s) = item.clone().downcast::<PyStr>() { | |
| 60 | 60 | if last_was_str { | |
| 61 | 61 | // Concatenate adjacent strings | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -824,7 +824,7 @@ impl PyType { | |||
| 824 | 824 | pub(crate) fn init_slots(&self, ctx: &Context) { | |
| 825 | 825 | // Inherit slots from MRO (mro[0] is self, so skip it) | |
| 826 | 826 | let mro: Vec<_> = self.mro.read()[1..].to_vec(); | |
| 827 | - for base in mro.iter() { | ||
| 827 | + for base in &mro { | ||
| 828 | 828 | self.inherit_slots(base); | |
| 829 | 829 | } | |
| 830 | 830 | ||
@@ -833,7 +833,7 @@ impl PyType { | |||
| 833 | 833 | let mut slot_name_set = std::collections::HashSet::new(); | |
| 834 | 834 | ||
| 835 | 835 | // mro[0] is self, so skip it; self.attributes is checked separately below | |
| 836 | - for cls in self.mro.read()[1..].iter() { | ||
| 836 | + for cls in &self.mro.read()[1..] { | ||
| 837 | 837 | for &name in cls.attributes.read().keys() { | |
| 838 | 838 | if name.as_bytes().starts_with(b"__") && name.as_bytes().ends_with(b"__") { | |
| 839 | 839 | slot_name_set.insert(name); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments