Skip to content

Commit e06aff1

Browse files
committed
fix: use the newly stabilized is_sorted_by method
1 parent e84d8fa commit e06aff1

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

ipld/hamt/src/node.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,7 @@ where
116116
conf.max_array_width,
117117
)));
118118
}
119-
if !kvs.windows(2).all(|window| {
120-
let [a, b] = window else {
121-
panic!("invalid window length")
122-
};
123-
a.key() < b.key()
124-
}) {
119+
if !kvs.is_sorted_by(|a, b| a.key() < b.key()) {
125120
return Err(Error::Dynamic(anyhow::anyhow!(
126121
"duplicate or unsorted keys in bucket"
127122
)));

ipld/kamt/src/node.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,7 @@ where
102102
conf.max_array_width,
103103
)));
104104
}
105-
if !kvs.windows(2).all(|window| {
106-
let [a, b] = window else {
107-
panic!("invalid window length")
108-
};
109-
a.key() < b.key()
110-
}) {
105+
if !kvs.is_sorted_by(|a, b| a.key() < b.key()) {
111106
return Err(Error::Dynamic(anyhow::anyhow!(
112107
"duplicate or unsorted keys in bucket"
113108
)));

0 commit comments

Comments
 (0)