mirror of
https://github.com/helix-editor/helix.git
synced 2025-10-06 00:13:28 +02:00
fix(lints): clippy 1.89-1.90 (#14223)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use std::{borrow::Cow, collections::HashMap, iter};
|
||||
use std::{borrow::Cow, collections::HashMap};
|
||||
|
||||
use helix_stdx::rope::RopeSliceExt;
|
||||
use tree_house::TREE_SITTER_MATCH_LIMIT;
|
||||
@@ -214,7 +214,10 @@ fn whitespace_with_same_width(text: RopeSlice) -> String {
|
||||
if grapheme == "\t" {
|
||||
s.push('\t');
|
||||
} else {
|
||||
s.extend(std::iter::repeat(' ').take(grapheme_width(&Cow::from(grapheme))));
|
||||
s.extend(std::iter::repeat_n(
|
||||
' ',
|
||||
grapheme_width(&Cow::from(grapheme)),
|
||||
));
|
||||
}
|
||||
}
|
||||
s
|
||||
@@ -243,10 +246,10 @@ pub fn normalize_indentation(
|
||||
original_len += 1;
|
||||
}
|
||||
if indent_style == IndentStyle::Tabs {
|
||||
dst.extend(iter::repeat('\t').take(len / tab_width));
|
||||
dst.extend(std::iter::repeat_n('\t', len / tab_width));
|
||||
len %= tab_width;
|
||||
}
|
||||
dst.extend(iter::repeat(' ').take(len));
|
||||
dst.extend(std::iter::repeat_n(' ', len));
|
||||
original_len
|
||||
}
|
||||
|
||||
|
@@ -361,7 +361,7 @@ impl Transform {
|
||||
}
|
||||
}
|
||||
FormatItem::Conditional(i, ref if_, ref else_) => {
|
||||
if cap.get_group(i).map_or(true, |mat| mat.is_empty()) {
|
||||
if cap.get_group(i).is_none_or(|mat| mat.is_empty()) {
|
||||
buf.push_str(else_)
|
||||
} else {
|
||||
buf.push_str(if_)
|
||||
|
@@ -562,15 +562,15 @@ impl Syntax {
|
||||
self.inner.tree_for_byte_range(start, end)
|
||||
}
|
||||
|
||||
pub fn named_descendant_for_byte_range(&self, start: u32, end: u32) -> Option<Node> {
|
||||
pub fn named_descendant_for_byte_range(&self, start: u32, end: u32) -> Option<Node<'_>> {
|
||||
self.inner.named_descendant_for_byte_range(start, end)
|
||||
}
|
||||
|
||||
pub fn descendant_for_byte_range(&self, start: u32, end: u32) -> Option<Node> {
|
||||
pub fn descendant_for_byte_range(&self, start: u32, end: u32) -> Option<Node<'_>> {
|
||||
self.inner.descendant_for_byte_range(start, end)
|
||||
}
|
||||
|
||||
pub fn walk(&self) -> TreeCursor {
|
||||
pub fn walk(&self) -> TreeCursor<'_> {
|
||||
self.inner.walk()
|
||||
}
|
||||
|
||||
@@ -1073,7 +1073,7 @@ fn node_is_visible(node: &Node) -> bool {
|
||||
node.is_missing() || (node.is_named() && node.grammar().node_kind_is_visible(node.kind_id()))
|
||||
}
|
||||
|
||||
fn format_anonymous_node_kind(kind: &str) -> Cow<str> {
|
||||
fn format_anonymous_node_kind(kind: &str) -> Cow<'_, str> {
|
||||
if kind.contains('"') {
|
||||
Cow::Owned(kind.replace('"', "\\\""))
|
||||
} else {
|
||||
@@ -1130,7 +1130,6 @@ fn pretty_print_tree_impl<W: fmt::Write>(
|
||||
}
|
||||
|
||||
/// Finds the child of `node` which contains the given byte range.
|
||||
|
||||
pub fn child_for_byte_range<'a>(node: &Node<'a>, range: ops::Range<u32>) -> Option<Node<'a>> {
|
||||
for child in node.children() {
|
||||
let child_range = child.byte_range();
|
||||
|
@@ -520,7 +520,7 @@ impl ChangeSet {
|
||||
pos
|
||||
}
|
||||
|
||||
pub fn changes_iter(&self) -> ChangeIterator {
|
||||
pub fn changes_iter(&self) -> ChangeIterator<'_> {
|
||||
ChangeIterator::new(self)
|
||||
}
|
||||
}
|
||||
@@ -753,7 +753,7 @@ impl Transaction {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn changes_iter(&self) -> ChangeIterator {
|
||||
pub fn changes_iter(&self) -> ChangeIterator<'_> {
|
||||
self.changes.changes_iter()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user