File tree 2 files changed +4
-7
lines changed
2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -519,11 +519,12 @@ fn decorate_table(table: &mut Table) {
519
519
}
520
520
}
521
521
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,
523
523
/// so keys without positions would be either:
524
524
/// 1. non-leaf keys (i.e. "foo" or "bar" in dotted key "foo.bar.baz")
525
525
/// 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
527
528
/// key in a dotted-key. So, we can safely return a constant value for these cases.
528
529
///
529
530
/// To support the most intuitive behavior, we return the maximum usize, placing
Original file line number Diff line number Diff line change @@ -1087,8 +1087,6 @@ foo.baz.asdf = "b"
1087
1087
let foo_baz_asdf_v = foo_baz. remove ( "asdf" ) . unwrap ( ) ;
1088
1088
let foo_baz_asdf_k = Key :: new ( "asdf" ) . with_position ( Some ( 0 ) ) ;
1089
1089
1090
- let foo_baz_asdf_k = foo_baz_asdf_k. with_position ( Some ( 0 ) ) ;
1091
-
1092
1090
foo_baz. insert_formatted ( & foo_baz_asdf_k, foo_baz_asdf_v) ;
1093
1091
} )
1094
1092
. produces_display ( str![ [ r#"foo.bar = 1
@@ -1120,9 +1118,7 @@ foo.baz.asdf = "b"
1120
1118
let foo_baz = as_table ! ( foo_baz_v) ;
1121
1119
1122
1120
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 ) ;
1126
1122
1127
1123
foo_baz. insert_formatted ( & foo_baz_asdf_k, foo_baz_asdf_v) ;
1128
1124
} )
You can’t perform that action at this time.
0 commit comments