diagnostics: Reduce cloning of DiagnosticEntry (#39193)
Release Notes: - N/A *or* Added/Fixed/Improved ...
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
DebuggerTextObject, LanguageScope, Outline, OutlineConfig, RunnableCapture, RunnableTag,
|
||||
TextObject, TreeSitterOptions,
|
||||
diagnostic_set::{DiagnosticEntry, DiagnosticGroup},
|
||||
diagnostic_set::{DiagnosticEntry, DiagnosticEntryRef, DiagnosticGroup},
|
||||
language_settings::{LanguageSettings, language_settings},
|
||||
outline::OutlineItem,
|
||||
syntax_map::{
|
||||
@@ -4519,7 +4519,7 @@ impl BufferSnapshot {
|
||||
&'a self,
|
||||
search_range: Range<T>,
|
||||
reversed: bool,
|
||||
) -> impl 'a + Iterator<Item = DiagnosticEntry<O>>
|
||||
) -> impl 'a + Iterator<Item = DiagnosticEntryRef<'a, O>>
|
||||
where
|
||||
T: 'a + Clone + ToOffset,
|
||||
O: 'a + FromAnchor,
|
||||
@@ -4552,11 +4552,13 @@ impl BufferSnapshot {
|
||||
})?;
|
||||
iterators[next_ix]
|
||||
.next()
|
||||
.map(|DiagnosticEntry { range, diagnostic }| DiagnosticEntry {
|
||||
diagnostic,
|
||||
range: FromAnchor::from_anchor(&range.start, self)
|
||||
..FromAnchor::from_anchor(&range.end, self),
|
||||
})
|
||||
.map(
|
||||
|DiagnosticEntryRef { range, diagnostic }| DiagnosticEntryRef {
|
||||
diagnostic,
|
||||
range: FromAnchor::from_anchor(&range.start, self)
|
||||
..FromAnchor::from_anchor(&range.end, self),
|
||||
},
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -4572,7 +4574,7 @@ impl BufferSnapshot {
|
||||
pub fn diagnostic_groups(
|
||||
&self,
|
||||
language_server_id: Option<LanguageServerId>,
|
||||
) -> Vec<(LanguageServerId, DiagnosticGroup<Anchor>)> {
|
||||
) -> Vec<(LanguageServerId, DiagnosticGroup<'_, Anchor>)> {
|
||||
let mut groups = Vec::new();
|
||||
|
||||
if let Some(language_server_id) = language_server_id {
|
||||
@@ -4603,7 +4605,7 @@ impl BufferSnapshot {
|
||||
pub fn diagnostic_group<O>(
|
||||
&self,
|
||||
group_id: usize,
|
||||
) -> impl Iterator<Item = DiagnosticEntry<O>> + '_
|
||||
) -> impl Iterator<Item = DiagnosticEntryRef<'_, O>> + use<'_, O>
|
||||
where
|
||||
O: FromAnchor + 'static,
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user