Skip to content

Commit 31bc18f

Browse files
authored
Rollup merge of #93630 - matthiaskrgr:clipperf, r=oli-obk
clippy::perf fixes single_char_pattern and to_string_in_format_args
2 parents 070c5f2 + de2abc2 commit 31bc18f

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

compiler/rustc_codegen_llvm/src/back/archive.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ impl<'a> ArchiveBuilder<'a> for LlvmArchiveBuilder<'a> {
219219

220220
match result {
221221
Err(e) => {
222-
self.config.sess.fatal(&format!("Error calling dlltool: {}", e.to_string()));
222+
self.config.sess.fatal(&format!("Error calling dlltool: {}", e));
223223
}
224224
Ok(output) if !output.status.success() => self.config.sess.fatal(&format!(
225225
"Dlltool could not create import library: {}\n{}",

compiler/rustc_interface/src/interface.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ pub fn parse_cfgspecs(cfgspecs: Vec<String>) -> FxHashSet<(String, Option<String
126126

127127
// If the user tried to use a key="value" flag, but is missing the quotes, provide
128128
// a hint about how to resolve this.
129-
if s.contains("=") && !s.contains("=\"") && !s.ends_with("\"") {
129+
if s.contains('=') && !s.contains("=\"") && !s.ends_with('"') {
130130
error!(concat!(
131131
r#"expected `key` or `key="value"`, ensure escaping is appropriate"#,
132132
r#" for your shell, try 'key="value"' or key=\"value\""#

compiler/rustc_parse/src/parser/expr.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1702,11 +1702,11 @@ impl<'a> Parser<'a> {
17021702

17031703
// Try to lowercase the prefix if it's a valid base prefix.
17041704
fn fix_base_capitalisation(s: &str) -> Option<String> {
1705-
if let Some(stripped) = s.strip_prefix("B") {
1705+
if let Some(stripped) = s.strip_prefix('B') {
17061706
Some(format!("0b{stripped}"))
1707-
} else if let Some(stripped) = s.strip_prefix("O") {
1707+
} else if let Some(stripped) = s.strip_prefix('O') {
17081708
Some(format!("0o{stripped}"))
1709-
} else if let Some(stripped) = s.strip_prefix("X") {
1709+
} else if let Some(stripped) = s.strip_prefix('X') {
17101710
Some(format!("0x{stripped}"))
17111711
} else {
17121712
None

compiler/rustc_typeck/src/check/expr.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1587,10 +1587,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
15871587
) {
15881588
let len = remaining_fields.len();
15891589

1590-
let mut displayable_field_names =
1591-
remaining_fields.keys().map(|ident| ident.as_str()).collect::<Vec<_>>();
1592-
1593-
displayable_field_names.sort();
1590+
let mut displayable_field_names: Vec<&str> =
1591+
remaining_fields.keys().map(|ident| ident.as_str()).collect();
1592+
// sorting &str primitives here, sort_unstable is ok
1593+
displayable_field_names.sort_unstable();
15941594

15951595
let mut truncated_fields_error = String::new();
15961596
let remaining_fields_names = match &displayable_field_names[..] {

0 commit comments

Comments
 (0)