Skip to content

Commit 779540e

Browse files
committed
style: Inline fmt args
1 parent 9eba6c6 commit 779540e

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

Diff for: src/lib.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ impl Line {
241241
) -> Result<(), std::io::Error> {
242242
match self {
243243
Self::Control { name, args } => {
244-
write!(out, ".{}", name)?;
244+
write!(out, ".{name}")?;
245245
for arg in args {
246246
write!(out, " {}", &escape_spaces(arg))?;
247247
}
@@ -267,9 +267,9 @@ impl Line {
267267
};
268268
let text = escape_leading_cc(&text);
269269
if let Inline::Bold(_) = inline {
270-
write!(out, r"\fB{}\fR", text)?;
270+
write!(out, r"\fB{text}\fR")?;
271271
} else if let Inline::Italic(_) = inline {
272-
write!(out, r"\fI{}\fR", text)?;
272+
write!(out, r"\fI{text}\fR")?;
273273
} else {
274274
if at_line_start && starts_with_cc(&text) {
275275
// Line would start with a period, so we
@@ -285,7 +285,7 @@ impl Line {
285285
// line.
286286
write!(out, r"\&").unwrap();
287287
}
288-
write!(out, "{}", text)?;
288+
write!(out, "{text}")?;
289289
}
290290
}
291291
}
@@ -307,7 +307,7 @@ fn starts_with_cc(line: &str) -> bool {
307307
/// quotes in any way: there doesn't seem to a way to escape them.
308308
fn escape_spaces(w: &str) -> String {
309309
if w.contains(' ') {
310-
format!("\"{}\"", w)
310+
format!("\"{w}\"")
311311
} else {
312312
w.to_owned()
313313
}

Diff for: tests/testsuite/demo.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ pub(crate) fn has_command(command: &str) -> bool {
7878
// CI is expected to support all of the commands
7979
if is_ci() && cfg!(target_os = "linux") {
8080
panic!(
81-
"expected command `{}` to be somewhere in PATH: {}",
82-
command, e
81+
"expected command `{command}` to be somewhere in PATH: {e}"
8382
);
8483
}
8584
return false;
@@ -99,8 +98,7 @@ pub(crate) fn has_command(command: &str) -> bool {
9998
let stdout = String::from_utf8_lossy(&output.stdout);
10099
println!(
101100
"$ {command} --version
102-
{}",
103-
stdout
101+
{stdout}"
104102
);
105103
if cfg!(target_os = "macos") && stdout.starts_with("GNU bash, version 3") {
106104
return false;

0 commit comments

Comments
 (0)