Skip to content

Commit 90fadb4

Browse files
MahadMuhammadCohenArthur
authored andcommitted
clippy: Refactor string formatting to use shorthand syntax
Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
1 parent 254255e commit 90fadb4

3 files changed

Lines changed: 4 additions & 7 deletions

File tree

src/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl fmt::Display for Error {
108108
let error_code = if error_code.is_empty() {
109109
error_code.to_owned()
110110
} else {
111-
format!(".{}.", error_code)
111+
format!(".{error_code}.")
112112
};
113113

114114
let rel_line_number = if self.relative_line_num == 0 {

src/header.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,5 @@ fn parse_name_value_directive(line: &str, directive: &str) -> Option<String> {
8484
}
8585

8686
fn to_dejagnu_edition(edition: &str) -> String {
87-
format!(
88-
"// {{ dg-additional-options \"-frust-edition={}\" }}",
89-
edition
90-
)
87+
format!("// {{ dg-additional-options \"-frust-edition={edition}\" }}")
9188
}

src/transform.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub fn transform_code(code: &str, stderr_file: Option<&str>) -> Result<String> {
4949
if error.relative_line_num != 0 {
5050
// We simply add the error message, not to worry about the code
5151
// The error was printed by our overloaded `Display` trait
52-
new_line = format!("{}", error);
52+
new_line = format!("{error}");
5353
} else {
5454
// For the error on the same line, we need to add error message at the end of the line
5555
let captures = captures_regex
@@ -62,7 +62,7 @@ pub fn transform_code(code: &str, stderr_file: Option<&str>) -> Result<String> {
6262
let before_match = &line[..whole_match.start()];
6363

6464
// The error was printed by our overloaded `Display` trait
65-
new_line = format!("{}{}", before_match, error);
65+
new_line = format!("{before_match}{error}");
6666
}
6767
break;
6868
}

0 commit comments

Comments
 (0)