Rollup merge of #76825 - lcnr:array-windows-apply, r=varkor
use `array_windows` instead of `windows` in the compiler I do think these changes are beautiful, but do have to admit that using type inference for the window length can easily be confusing. This seems like a general issue with const generics, where inferring constants adds an additional complexity which users have to learn and keep in mind.
This commit is contained in:
commit
50d56bc774
11 changed files with 24 additions and 20 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
#![allow(incomplete_features)]
|
||||
#![feature(array_windows)]
|
||||
#![feature(control_flow_enum)]
|
||||
#![feature(in_band_lifetimes)]
|
||||
#![feature(unboxed_closures)]
|
||||
|
|
|
@ -34,7 +34,7 @@ impl<K: Ord, V> SortedMap<K, V> {
|
|||
/// and that there are no duplicates.
|
||||
#[inline]
|
||||
pub fn from_presorted_elements(elements: Vec<(K, V)>) -> SortedMap<K, V> {
|
||||
debug_assert!(elements.windows(2).all(|w| w[0].0 < w[1].0));
|
||||
debug_assert!(elements.array_windows().all(|[fst, snd]| fst.0 < snd.0));
|
||||
|
||||
SortedMap { data: elements }
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ impl<K: Ord, V> SortedMap<K, V> {
|
|||
return;
|
||||
}
|
||||
|
||||
debug_assert!(elements.windows(2).all(|w| w[0].0 < w[1].0));
|
||||
debug_assert!(elements.array_windows().all(|[fst, snd]| fst.0 < snd.0));
|
||||
|
||||
let start_index = self.lookup_index_for(&elements[0].0);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue