Skip to content

Commit

Permalink
use inline format args (clippy::uninlined_format_args)
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleades authored and Byron committed Aug 20, 2024
1 parent 6e2ae15 commit d97f8f5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ where
Strong => formatter.write_str(options.strong_token),
FootnoteDefinition(ref name) => {
state.padding.push(" ".into());
write!(formatter, "[^{}]: ", name)
write!(formatter, "[^{name}]: ")
}
Paragraph => Ok(()),
Heading {
Expand Down Expand Up @@ -644,13 +644,13 @@ where
}
Ok(())
}
FootnoteReference(ref name) => write!(formatter, "[^{}]", name),
FootnoteReference(ref name) => write!(formatter, "[^{name}]"),
TaskListMarker(checked) => {
let check = if checked { "x" } else { " " };
write!(formatter, "[{}] ", check)
write!(formatter, "[{check}] ")
}
InlineMath(ref text) => write!(formatter, "${}$", text),
DisplayMath(ref text) => write!(formatter, "$${}$$", text),
InlineMath(ref text) => write!(formatter, "${text}$"),
DisplayMath(ref text) => write!(formatter, "$${text}$$"),
}
}

Expand All @@ -674,9 +674,9 @@ where
};

if uri.contains(' ') {
write!(f, "]{}<{uri}>", separator, uri = uri)?;
write!(f, "]{separator}<{uri}>")?;
} else {
write!(f, "]{}{uri}", separator, uri = uri)?;
write!(f, "]{separator}{uri}")?;
}
if !title.is_empty() {
write!(f, " \"{title}\"", title = EscapeLinkTitle(title))?;
Expand Down
4 changes: 2 additions & 2 deletions src/text_modifications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ where
F: fmt::Write,
{
for padding in p {
write!(f, "{}", padding)?;
write!(f, "{padding}")?;
}
Ok(())
}
Expand Down Expand Up @@ -64,6 +64,6 @@ where
pub fn padding_of(l: Option<u64>) -> Cow<'static, str> {
match l {
None => " ".into(),
Some(n) => format!("{}. ", n).chars().map(|_| ' ').collect::<String>().into(),
Some(n) => format!("{n}. ").chars().map(|_| ' ').collect::<String>().into(),
}
}
4 changes: 2 additions & 2 deletions tests/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ fn assert_events_eq(s: &str) {

let before_events = Parser::new_ext(s, Options::all());
let after_events = Parser::new_ext(&buf, Options::all());
println!("{}", buf);
println!("{buf}");
assert_eq!(before_events.collect::<Vec<_>>(), after_events.collect::<Vec<_>>());
}

Expand Down Expand Up @@ -965,7 +965,7 @@ mod escapes {

fn run_test_on_each_special_char(f: impl Fn(String, CowStr)) {
for c in CmarkToCmarkOptions::default().special_characters().chars() {
let s = format!(r#"\{special}"#, special = c);
let s = format!(r#"\{c}"#);
f(s, c.to_string().into());
}
}
Expand Down

0 comments on commit d97f8f5

Please sign in to comment.