Skip to content

Commit e47ca9c

Browse files
committed
fix(fmt+clippy): sigh
1 parent fb9d725 commit e47ca9c

File tree

7 files changed

+24
-27
lines changed

7 files changed

+24
-27
lines changed

clippy.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
msrv = "1.71.1"
1+
msrv = "1.81"

examples/insert-node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ words {
2929
word_nodes.sort_by(sort_by_name);
3030
words_section.autoformat();
3131

32-
println!("{}", doc);
32+
println!("{doc}");
3333

3434
// output:
3535
// words {

src/document.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -696,21 +696,21 @@ final;";
696696

697697
let bar = doc.get("bar").expect("expected a bar node");
698698
assert_eq!(
699-
format!("{}", bar),
699+
format!("{bar}"),
700700
"\n bar \"indented\" // trailing whitespace after this\t\n"
701701
);
702702

703703
let a = doc.get("a").expect("expected a node");
704704
assert_eq!(
705-
format!("{}", a),
705+
format!("{a}"),
706706
"/*\nSome random comment\n */\n\na;".to_string()
707707
);
708708

709709
let b = doc.get("b").expect("expected a node");
710-
assert_eq!(format!("{}", b), " b;".to_string());
710+
assert_eq!(format!("{b}"), " b;".to_string());
711711

712712
// Round-tripping works.
713-
assert_eq!(format!("{}", doc), src);
713+
assert_eq!(format!("{doc}"), src);
714714

715715
// Programmatic manipulation works.
716716
let mut node: KdlNode = "new\n".parse()?;
@@ -721,7 +721,7 @@ final;";
721721
doc.nodes_mut().push(node);
722722

723723
assert_eq!(
724-
format!("{}", doc),
724+
format!("{doc}"),
725725
format!("{}new \"blah\"=0xDEADbeef\n", src)
726726
);
727727

@@ -754,7 +754,7 @@ bar prop=value 1 2 #false #null {
754754
}
755755
baz
756756
"#,
757-
format!("{}", doc)
757+
format!("{doc}")
758758
);
759759
}
760760

src/entry.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,10 +633,10 @@ mod test {
633633
#[test]
634634
fn display() {
635635
let entry = KdlEntry::new(KdlValue::Integer(42));
636-
assert_eq!(format!("{}", entry), "42");
636+
assert_eq!(format!("{entry}"), "42");
637637

638638
let entry = KdlEntry::new_prop("name", KdlValue::Integer(42));
639-
assert_eq!(format!("{}", entry), "name=42");
639+
assert_eq!(format!("{entry}"), "name=42");
640640
}
641641

642642
#[cfg(feature = "v1")]

src/identifier.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,13 @@ mod test {
215215
#[test]
216216
fn formatting() {
217217
let plain = KdlIdentifier::from("foo");
218-
assert_eq!(format!("{}", plain), "foo");
218+
assert_eq!(format!("{plain}"), "foo");
219219

220220
let quoted = KdlIdentifier::from("foo\"bar");
221-
assert_eq!(format!("{}", quoted), r#""foo\"bar""#);
221+
assert_eq!(format!("{quoted}"), r#""foo\"bar""#);
222222

223223
let mut custom_repr = KdlIdentifier::from("foo");
224224
custom_repr.set_repr(r#""foo/bar""#.to_string());
225-
assert_eq!(format!("{}", custom_repr), r#""foo/bar""#);
225+
assert_eq!(format!("{custom_repr}"), r#""foo/bar""#);
226226
}
227227
}

src/v2_parser.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,10 @@ fn unambiguous_ident(input: &mut Input<'_>) -> PResult<()> {
966966
cut_err(
967967
repeat(1.., identifier_char)
968968
.verify_map(|s: String| {
969-
if matches!(s.as_str(), "true" | "false" | "null" | "inf" | "-inf" | "nan") {
969+
if matches!(
970+
s.as_str(),
971+
"true" | "false" | "null" | "inf" | "-inf" | "nan"
972+
) {
970973
None
971974
} else {
972975
Some(s)

src/value.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ impl PartialEq for KdlValue {
3838
match (self, other) {
3939
(Self::String(l0), Self::String(r0)) => l0 == r0,
4040
(Self::Integer(l0), Self::Integer(r0)) => l0 == r0,
41-
(Self::Float(l0), Self::Float(r0)) => {
42-
normalize_float(l0) == normalize_float(r0)
43-
}
41+
(Self::Float(l0), Self::Float(r0)) => normalize_float(l0) == normalize_float(r0),
4442
(Self::Bool(l0), Self::Bool(r0)) => l0 == r0,
4543
_ => core::mem::discriminant(self) == core::mem::discriminant(other),
4644
}
@@ -161,11 +159,7 @@ pub(crate) fn is_plain_ident(ident: &str) -> bool {
161159
.find(crate::v2_parser::is_disallowed_ident_char)
162160
.is_none()
163161
&& ident_bytes.first().map(|c| c.is_ascii_digit()) != Some(true)
164-
&& !(ident
165-
.chars()
166-
.next()
167-
.map(|c| matches!(c, '.' | '-' | '+'))
168-
== Some(true)
162+
&& !(ident.chars().next().map(|c| matches!(c, '.' | '-' | '+')) == Some(true)
169163
&& ident_bytes.get(1).map(|c| c.is_ascii_digit()) == Some(true))
170164
&& ident != "inf"
171165
&& ident != "-inf"
@@ -272,18 +266,18 @@ mod test {
272266
#[test]
273267
fn formatting() {
274268
let string = KdlValue::String("foo\n".into());
275-
assert_eq!(format!("{}", string), r#""foo\n""#);
269+
assert_eq!(format!("{string}"), r#""foo\n""#);
276270

277271
let integer = KdlValue::Integer(1234567890);
278-
assert_eq!(format!("{}", integer), "1234567890");
272+
assert_eq!(format!("{integer}"), "1234567890");
279273

280274
let float = KdlValue::Float(1234567890.12345);
281-
assert_eq!(format!("{}", float), "1234567890.12345");
275+
assert_eq!(format!("{float}"), "1234567890.12345");
282276

283277
let boolean = KdlValue::Bool(true);
284-
assert_eq!(format!("{}", boolean), "#true");
278+
assert_eq!(format!("{boolean}"), "#true");
285279

286280
let null = KdlValue::Null;
287-
assert_eq!(format!("{}", null), "#null");
281+
assert_eq!(format!("{null}"), "#null");
288282
}
289283
}

0 commit comments

Comments
 (0)