Skip to content

Commit 150d5f8

Browse files
committed
chore: make linter happy
1 parent d72ad7f commit 150d5f8

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

crates/toml_edit/src/table.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -519,11 +519,12 @@ fn decorate_table(table: &mut Table) {
519519
}
520520
}
521521

522-
/// sort_by_key works because we add the position to _every_ item's key during parsing,
522+
/// `Vec::sort_by_key` works because we add the position to _every_ item's key during parsing,
523523
/// so keys without positions would be either:
524524
/// 1. non-leaf keys (i.e. "foo" or "bar" in dotted key "foo.bar.baz")
525525
/// 2. custom keys added to the doc without an explicit position
526-
/// and in the case of (1), we'd never see it since we only look at the last
526+
///
527+
/// In the case of (1), we'd never see it since we only look at the last
527528
/// key in a dotted-key. So, we can safely return a constant value for these cases.
528529
///
529530
/// To support the most intuitive behavior, we return the maximum usize, placing

crates/toml_edit/tests/testsuite/edit.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1087,8 +1087,6 @@ foo.baz.asdf = "b"
10871087
let foo_baz_asdf_v = foo_baz.remove("asdf").unwrap();
10881088
let foo_baz_asdf_k = Key::new("asdf").with_position(Some(0));
10891089

1090-
let foo_baz_asdf_k = foo_baz_asdf_k.with_position(Some(0));
1091-
10921090
foo_baz.insert_formatted(&foo_baz_asdf_k, foo_baz_asdf_v);
10931091
})
10941092
.produces_display(str![[r#"foo.bar = 1
@@ -1120,9 +1118,7 @@ foo.baz.asdf = "b"
11201118
let foo_baz = as_table!(foo_baz_v);
11211119

11221120
let foo_baz_asdf_v = foo_baz.remove("qwer").unwrap();
1123-
let foo_baz_asdf_k = Key::new("qwer").with_position(Some(0));
1124-
1125-
let foo_baz_asdf_k = foo_baz_asdf_k.clone().with_position(None);
1121+
let foo_baz_asdf_k = Key::new("qwer").with_position(None);
11261122

11271123
foo_baz.insert_formatted(&foo_baz_asdf_k, foo_baz_asdf_v);
11281124
})

0 commit comments

Comments
 (0)