diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-07-17 01:20:10 +0200 |
|---|---|---|
| committer | Matthias Krüger <matthias.krueger@famsik.de> | 2021-07-17 01:20:10 +0200 |
| commit | 8462a378f313f7f279fb8f98a7dad703ef9ef897 (patch) | |
| tree | fd12a53afd42274a459dbe90831bc77c8018c7f9 /compiler/rustc_infer/src | |
| parent | 74ef0c3e404cc72c08b2d1e14506f90d9e877269 (diff) | |
| download | rust-8462a378f313f7f279fb8f98a7dad703ef9ef897.tar.gz rust-8462a378f313f7f279fb8f98a7dad703ef9ef897.zip | |
avoid temporary vectors
Avoid collecting an interator just to re-iterate immediately. Rather reuse the previous iterator. (clippy::needless_collect)
Diffstat (limited to 'compiler/rustc_infer/src')
| -rw-r--r-- | compiler/rustc_infer/src/infer/error_reporting/mod.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index e3a79fe2653..a5a804a2916 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -2134,7 +2134,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { let new_lt = generics .as_ref() .and_then(|(parent_g, g)| { - let possible: Vec<_> = (b'a'..=b'z').map(|c| format!("'{}", c as char)).collect(); + let mut possible = (b'a'..=b'z').map(|c| format!("'{}", c as char)); let mut lts_names = g .params .iter() @@ -2150,7 +2150,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { ); } let lts = lts_names.iter().map(|s| -> &str { &*s }).collect::<Vec<_>>(); - possible.into_iter().find(|candidate| !lts.contains(&candidate.as_str())) + possible.find(|candidate| !lts.contains(&candidate.as_str())) }) .unwrap_or("'lt".to_string()); let add_lt_sugg = generics |
