chore: Fix warnings for Rust 1.89 (#32378)

Closes #ISSUE

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-06-09 13:11:57 +02:00 committed by GitHub
parent 4ff41ba62e
commit 72bcb0beb7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 102 additions and 95 deletions

View file

@ -3127,7 +3127,7 @@ impl BufferSnapshot {
None
}
fn get_highlights(&self, range: Range<usize>) -> (SyntaxMapCaptures, Vec<HighlightMap>) {
fn get_highlights(&self, range: Range<usize>) -> (SyntaxMapCaptures<'_>, Vec<HighlightMap>) {
let captures = self.syntax.captures(range, &self.text, |grammar| {
grammar.highlights_query.as_ref()
});
@ -3143,7 +3143,7 @@ impl BufferSnapshot {
/// in an arbitrary way due to being stored in a [`Rope`](text::Rope). The text is also
/// returned in chunks where each chunk has a single syntax highlighting style and
/// diagnostic status.
pub fn chunks<T: ToOffset>(&self, range: Range<T>, language_aware: bool) -> BufferChunks {
pub fn chunks<T: ToOffset>(&self, range: Range<T>, language_aware: bool) -> BufferChunks<'_> {
let range = range.start.to_offset(self)..range.end.to_offset(self);
let mut syntax = None;
@ -3192,12 +3192,12 @@ impl BufferSnapshot {
}
/// Iterates over every [`SyntaxLayer`] in the buffer.
pub fn syntax_layers(&self) -> impl Iterator<Item = SyntaxLayer> + '_ {
pub fn syntax_layers(&self) -> impl Iterator<Item = SyntaxLayer<'_>> + '_ {
self.syntax
.layers_for_range(0..self.len(), &self.text, true)
}
pub fn syntax_layer_at<D: ToOffset>(&self, position: D) -> Option<SyntaxLayer> {
pub fn syntax_layer_at<D: ToOffset>(&self, position: D) -> Option<SyntaxLayer<'_>> {
let offset = position.to_offset(self);
self.syntax
.layers_for_range(offset..offset, &self.text, false)
@ -3208,7 +3208,7 @@ impl BufferSnapshot {
pub fn smallest_syntax_layer_containing<D: ToOffset>(
&self,
range: Range<D>,
) -> Option<SyntaxLayer> {
) -> Option<SyntaxLayer<'_>> {
let range = range.to_offset(self);
return self
.syntax
@ -3426,7 +3426,7 @@ impl BufferSnapshot {
}
/// Returns the root syntax node within the given row
pub fn syntax_root_ancestor(&self, position: Anchor) -> Option<tree_sitter::Node> {
pub fn syntax_root_ancestor(&self, position: Anchor) -> Option<tree_sitter::Node<'_>> {
let start_offset = position.to_offset(self);
let row = self.summary_for_anchor::<text::PointUtf16>(&position).row as usize;
@ -3763,7 +3763,7 @@ impl BufferSnapshot {
&self,
range: Range<usize>,
query: fn(&Grammar) -> Option<&tree_sitter::Query>,
) -> SyntaxMapMatches {
) -> SyntaxMapMatches<'_> {
self.syntax.matches(range, self, query)
}

View file

@ -1126,7 +1126,7 @@ impl<'a> SyntaxMapMatches<'a> {
&self.grammars
}
pub fn peek(&self) -> Option<SyntaxMapMatch> {
pub fn peek(&self) -> Option<SyntaxMapMatch<'_>> {
let layer = self.layers.first()?;
if !layer.has_next {
@ -1550,7 +1550,7 @@ fn insert_newlines_between_ranges(
impl OwnedSyntaxLayer {
/// Returns the root syntax node for this layer.
pub fn node(&self) -> Node {
pub fn node(&self) -> Node<'_> {
self.tree
.root_node_with_offset(self.offset.0, self.offset.1)
}