Detailed changes
@@ -906,7 +906,7 @@ impl Chunk {
fn clip_offset_utf16(&self, target: OffsetUtf16, bias: Bias) -> OffsetUtf16 {
let mut code_units = self.0.encode_utf16();
- let mut offset = code_units.by_ref().take(target.0 as usize).count();
+ let mut offset = code_units.by_ref().take(target.0).count();
if char::decode_utf16(code_units).next().transpose().is_err() {
match bias {
Bias::Left => offset -= 1,
@@ -40,7 +40,7 @@ impl<K: Clone + Debug + Default + Ord, V: Clone + Debug> TreeMap<K, V> {
self.0.is_empty()
}
- pub fn get<'a>(&self, key: &'a K) -> Option<&V> {
+ pub fn get(&self, key: &K) -> Option<&V> {
let mut cursor = self.0.cursor::<MapKeyRef<'_, K>>();
cursor.seek(&MapKeyRef(Some(key)), Bias::Left, &());
if let Some(item) = cursor.item() {
@@ -98,9 +98,7 @@ impl<K: Clone + Debug + Default + Ord, V: Clone + Debug> TreeMap<K, V> {
let from_key = MapKeyRef(Some(from));
cursor.seek(&from_key, Bias::Left, &());
- cursor
- .into_iter()
- .map(|map_entry| (&map_entry.key, &map_entry.value))
+ cursor.map(|map_entry| (&map_entry.key, &map_entry.value))
}
pub fn update<F, T>(&mut self, key: &K, f: F) -> Option<T>
@@ -20,11 +20,11 @@ impl Locator {
}
pub fn min_ref() -> &'static Self {
- &*MIN
+ &MIN
}
pub fn max_ref() -> &'static Self {
- &*MAX
+ &MAX
}
pub fn assign(&mut self, other: &Self) {
@@ -18,7 +18,7 @@ impl Topic {
}
pub fn publish(&self, edits: impl Clone + IntoIterator<Item = Edit<usize>>) {
- publish(&mut *self.0.lock(), edits);
+ publish(&mut self.0.lock(), edits);
}
pub fn publish_mut(&mut self, edits: impl Clone + IntoIterator<Item = Edit<usize>>) {
@@ -2655,7 +2655,7 @@ impl LineEnding {
max_ix -= 1;
}
- if let Some(ix) = text[..max_ix].find(&['\n']) {
+ if let Some(ix) = text[..max_ix].find(['\n']) {
if ix > 0 && text.as_bytes()[ix - 1] == b'\r' {
Self::Windows
} else {
@@ -67,8 +67,8 @@ impl<T: AsRef<Path>> PathExt for T {
fn icon_suffix(&self) -> Option<&str> {
let file_name = self.as_ref().file_name()?.to_str()?;
- if file_name.starts_with(".") {
- return file_name.strip_prefix(".");
+ if file_name.starts_with('.') {
+ return file_name.strip_prefix('.');
}
self.as_ref()
@@ -213,7 +213,7 @@ impl Eq for PathMatcher {}
impl PathMatcher {
pub fn new(maybe_glob: &str) -> Result<Self, globset::Error> {
Ok(PathMatcher {
- glob: Glob::new(&maybe_glob)?.compile_matcher(),
+ glob: Glob::new(maybe_glob)?.compile_matcher(),
maybe_path: PathBuf::from(maybe_glob),
})
}