Skip to content

Commit 1b9b4b1

Browse files
authored
fix macro usages
make clippy happy
1 parent bbde586 commit 1b9b4b1

File tree

7 files changed

+19
-19
lines changed

7 files changed

+19
-19
lines changed

build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn generate_integ_test_cases(out_dir: &String) -> Result<(), String> {
5252
if let Some(files) = &spec_file_parsed.given.files {
5353
out.with_indent(|out| {
5454
for (file_name, file_content) in files {
55-
out.writeln(&format!("({:?}, {:?}),", file_name, file_content));
55+
out.writeln(&format!("({file_name:?}, {file_content:?}),"));
5656
}
5757
});
5858
}

src/md_elem/tree.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -302,29 +302,29 @@ impl Display for InvalidMd {
302302
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
303303
match self {
304304
InvalidMd::Unsupported(node) => {
305-
write!(f, "unsupported node: {:?}", node)
305+
write!(f, "unsupported node: {node:?}")
306306
}
307307
InvalidMd::NonListItemDirectlyUnderList(node) => {
308-
write!(f, "expected a list item, but found: {:?}", node)
308+
write!(f, "expected a list item, but found: {node:?}")
309309
}
310310
InvalidMd::NonRowDirectlyUnderTable(node) => {
311-
write!(f, "expected a row, but found: {:?}", node)
311+
write!(f, "expected a row, but found: {node:?}")
312312
}
313313
InvalidMd::NonInlineWhereInlineExpected(node) => {
314-
write!(f, "expected an inline element, but found: {:?}", node)
314+
write!(f, "expected an inline element, but found: {node:?}")
315315
}
316316
InvalidMd::MissingReferenceDefinition(id) => {
317-
write!(f, "couldn't find definition for link/image/footnote: {}", id)
317+
write!(f, "couldn't find definition for link/image/footnote: {id}")
318318
}
319319
InvalidMd::ConflictingReferenceDefinition(id) => {
320-
write!(f, "found multiple definitions for link/image/footnote: {}", id)
320+
write!(f, "found multiple definitions for link/image/footnote: {id}")
321321
}
322322
InvalidMd::InternalError(err) => {
323323
f.write_str("internal error\n")?;
324324
std::fmt::Display::fmt(&err.backtrace, f)
325325
}
326326
InvalidMd::UnknownMarkdown(description) => {
327-
write!(f, "encountered unknown markdown: {}\n\n", description)?;
327+
write!(f, "encountered unknown markdown: {description}\n\n")?;
328328
f.write_str("* Please consider reporting this at https://github.com/yshavit/mdq/issues\n")?;
329329
f.write_str("* You can suppress this error by using --allow-unknown-markdown.")
330330
}
@@ -1948,7 +1948,7 @@ impl<'a> Lookups<'a> {
19481948
}
19491949

19501950
fn build_lookups(&mut self, node: &mdast::Node, read_opts: &ReadOptions) -> Result<(), InvalidMd> {
1951-
let x = format!("{:?}", node);
1951+
let x = format!("{node:?}");
19521952
let _ = x;
19531953
match node {
19541954
mdast::Node::FootnoteDefinition(def) => {
@@ -3426,13 +3426,13 @@ mod tests {
34263426
{
34273427
match result {
34283428
Ok(lookups) => check(lookups),
3429-
Err(err) => panic!("expected good Lookups, but got: {:?}", err),
3429+
Err(err) => panic!("expected good Lookups, but got: {err:?}"),
34303430
}
34313431
}
34323432

34333433
fn expect_absent(result: Result<Lookups<'static>, InvalidMd>, expect: InvalidMd) {
34343434
match result {
3435-
Ok(_) => panic!("expected {:?}, but got good Lookups", expect),
3435+
Ok(_) => panic!("expected {expect:?}, but got good Lookups"),
34363436
Err(err) => assert_eq!(err, expect),
34373437
}
34383438
}
@@ -3870,14 +3870,14 @@ mod tests {
38703870
_ => ("", ""),
38713871
};
38723872
if !tag.is_empty() {
3873-
out.push_str(&format!("<{}>", tag))
3873+
out.push_str(&format!("<{tag}>"))
38743874
}
38753875
out.push_str(text);
38763876
if let Some(children) = node.children() {
38773877
children.iter().for_each(|c| build(out, c));
38783878
}
38793879
if !tag.is_empty() {
3880-
out.push_str(&format!("</{}>", tag))
3880+
out.push_str(&format!("</{tag}>"))
38813881
}
38823882
}
38833883
let mut s = String::with_capacity(32);

src/md_elem/tree_ref.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ mod tests {
231231

232232
fn cell_matches(substring: &str) -> impl Fn(&TableCell) -> Result<bool, ()> + '_ {
233233
move |line| {
234-
let line_str = format!("{:?}", line);
234+
let line_str = format!("{line:?}");
235235
Ok(line_str.contains(substring))
236236
}
237237
}

src/output/fmt_plain_inline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ where
8484
MdElem::BlockQuote(block) => write_plain_result(out, block.body.iter()),
8585
MdElem::CodeBlock(CodeBlock { value: body, .. }) | MdElem::FrontMatter(FrontMatter { body, .. }) => {
8686
if !body.is_empty() {
87-
writeln!(out, "{}", body)?;
87+
writeln!(out, "{body}")?;
8888
writeln!(out)?;
8989
}
9090
Ok(())

src/output/output_adapter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<W: fmt::Write> SimpleWrite for IoAdapter<W> {
5757
fn write_char(&mut self, ch: char) -> io::Result<()> {
5858
self.0
5959
.write_char(ch)
60-
.map_err(|err| io::Error::other(format!("while writing char: {}", err)))
60+
.map_err(|err| io::Error::other(format!("while writing char: {err}")))
6161
}
6262

6363
fn flush(&mut self) -> io::Result<()> {

src/util/output.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ impl<W: SimpleWrite> Drop for Output<W> {
219219
}
220220
if let Err(e) = self.stream.flush() {
221221
if WritingState::Error != self.writing_state {
222-
eprintln!("error while writing output: {}", e);
222+
eprintln!("error while writing output: {e}");
223223
self.writing_state = WritingState::Error;
224224
}
225225
}
@@ -469,7 +469,7 @@ impl WritingState {
469469
return;
470470
}
471471
if let Err(e) = out.write_char(ch) {
472-
eprintln!("error while writing output: {}", e);
472+
eprintln!("error while writing output: {e}");
473473
*self = WritingState::Error;
474474
}
475475
if matches!(*self, WritingState::HaveNotWrittenAnything) {

tests/integ_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl<const N: usize> mdq::run::OsFacade for CaseRunner<'_, N> {
3232
return Ok(content.to_string());
3333
}
3434
}
35-
Err(io::Error::new(ErrorKind::NotFound, format!("File not found: {}", path)))
35+
Err(io::Error::new(ErrorKind::NotFound, format!("File not found: {path}")))
3636
}
3737

3838
fn stdout(&mut self) -> impl io::Write {

0 commit comments

Comments
 (0)