clippy: fix explicit_into_iter_loop lint

https://rust-lang.github.io/rust-clippy/master/index.html#explicit_into_iter_loop

Closes #12340
This commit is contained in:
xtqqczze
2026-01-17 02:40:46 +00:00
committed by Johannes Altmanninger
parent 9dfb5705c5
commit 5e3bc86268
7 changed files with 9 additions and 8 deletions

View File

@@ -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

View File

@@ -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();

View File

@@ -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());
}

View File

@@ -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);
}
}

View File

@@ -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))

View File

@@ -646,7 +646,7 @@ fn create_export_array(&self) -> Arc<OwningNullTerminatedArray> {
// Construct the export list: a list of strings of the form key=value.
let mut export_list: Vec<CString> = 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());

View File

@@ -84,7 +84,7 @@ fn append_space_separated_list<S: AsRef<str>>(
string: &mut WString,
list: impl IntoIterator<Item = S>,
) {
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(),