diff --git a/Cargo.toml b/Cargo.toml index ed19ec2b7..96ac30af5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -193,6 +193,7 @@ rustdoc.private_intra_doc_links = "allow" [workspace.lints.clippy] assigning_clones = "warn" cloned_instead_of_copied = "warn" +explicit_into_iter_loop = "warn" format_push_string = "warn" implicit_clone = "warn" len_without_is_empty = "allow" # we're not a library crate diff --git a/crates/printf/src/tests.rs b/crates/printf/src/tests.rs index 98e713778..1895a3bc7 100644 --- a/crates/printf/src/tests.rs +++ b/crates/printf/src/tests.rs @@ -861,8 +861,8 @@ fn test_float_hex_prec() { let mut libc_sprintf = libc_sprintf_one_float_with_precision(&mut c_storage, c"%.*a"); let mut failed = false; - for sign in [1.0, -1.0].into_iter() { - for mut v in [0.0, 0.5, 1.0, 1.5, PI, TAU, E].into_iter() { + for sign in [1.0, -1.0] { + for mut v in [0.0, 0.5, 1.0, 1.5, PI, TAU, E] { v *= sign; for preci in 1..=200_usize { rust_str.clear(); diff --git a/src/builtins/function.rs b/src/builtins/function.rs index 737c1a193..04655d568 100644 --- a/src/builtins/function.rs +++ b/src/builtins/function.rs @@ -355,7 +355,7 @@ pub fn function( function::add(function_name.clone(), Arc::new(props)); // Handle wrap targets by creating the appropriate completions. - for wt in opts.wrap_targets.into_iter() { + for wt in opts.wrap_targets { complete_add_wrapper(function_name.clone(), wt.clone()); } diff --git a/src/builtins/string/match.rs b/src/builtins/string/match.rs index b62ebed1a..a51930102 100644 --- a/src/builtins/string/match.rs +++ b/src/builtins/string/match.rs @@ -146,7 +146,7 @@ fn handle( .. }) = matcher { - for (name, vals) in first_match_captures.into_iter() { + for (name, vals) in first_match_captures { parser.set_var(&WString::from(name), ParserEnvSetMode::default(), vals); } } diff --git a/src/common.rs b/src/common.rs index 2914bb6fa..b0fda228c 100644 --- a/src/common.rs +++ b/src/common.rs @@ -256,7 +256,7 @@ fn byte_to_hex(byte: u8) -> (char, char) { fn escape_string_url(input: &wstr) -> WString { let narrow = wcs2bytes(input); let mut out = WString::new(); - for byte in narrow.into_iter() { + for byte in narrow { if (byte & 0x80) == 0 { let c = char::from_u32(u32::from(byte)).unwrap(); if c.is_alphanumeric() || [b'/', b'.', b'~', b'-', b'_'].contains(&byte) { @@ -279,7 +279,7 @@ fn escape_string_var(input: &wstr) -> WString { let mut prev_was_hex_encoded = false; let narrow = wcs2bytes(input); let mut out = WString::new(); - for c in narrow.into_iter() { + for c in narrow { let ch: char = c.into(); if ((c & 0x80) == 0 && ch.is_alphanumeric()) && (!prev_was_hex_encoded || !is_upper_hex_digit(ch)) diff --git a/src/env/environment_impl.rs b/src/env/environment_impl.rs index 36882463d..27bd1c269 100644 --- a/src/env/environment_impl.rs +++ b/src/env/environment_impl.rs @@ -646,7 +646,7 @@ fn create_export_array(&self) -> Arc { // Construct the export list: a list of strings of the form key=value. let mut export_list: Vec = Vec::with_capacity(vals.len()); - for (key, val) in vals.into_iter() { + for (key, val) in vals { let mut str = key; str.push('='); str.push_utfstr(&val.as_string()); diff --git a/src/localization/settings.rs b/src/localization/settings.rs index 0fdcc46ed..c965f8dc0 100644 --- a/src/localization/settings.rs +++ b/src/localization/settings.rs @@ -84,7 +84,7 @@ fn append_space_separated_list>( string: &mut WString, list: impl IntoIterator, ) { - for lang in list.into_iter() { + for lang in list { string.push(' '); string.push_utfstr(&crate::common::escape( WString::from_str(lang.as_ref()).as_utfstr(),