Skip to content

Commit 1475b09

Browse files
committed
refactor: replace Vec<String> with Vec<&str>
1 parent 18a5a73 commit 1475b09

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crates/ruff_linter/src/rules/flake8_logging_format/rules/logging_call.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fn logging_f_string(
2929
}
3030

3131
let mut format_string = String::new();
32-
let mut args = Vec::new();
32+
let mut args: Vec<&str> = Vec::new();
3333

3434
// Try to reuse the first part's quote style when building the replacement.
3535
// Default to double quotes if we can't determine it.
@@ -64,7 +64,7 @@ fn logging_f_string(
6464
match interpolated.expression.as_ref() {
6565
Expr::Name(name) => {
6666
format_string.push_str("%s");
67-
args.push(name.id.to_string());
67+
args.push(name.id.as_str());
6868
}
6969
_ => return,
7070
}
@@ -78,12 +78,12 @@ fn logging_f_string(
7878
}
7979

8080
// Determine names of existing trailing positional args (after the `msg` argument).
81-
let existing_names: Vec<String> = arguments
81+
let existing_names: Vec<&str> = arguments
8282
.args
8383
.iter()
8484
.skip(msg_pos + 1)
8585
.filter_map(|arg| match arg {
86-
Expr::Name(name) => Some(name.id.to_string()),
86+
Expr::Name(name) => Some(name.id.as_str()),
8787
_ => None,
8888
})
8989
.collect();

0 commit comments

Comments
 (0)