mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 21:13:37 +00:00
Adress new clippy::large_enum_variant diagnostics
This commit is contained in:
parent
07c1b83e98
commit
1013bf36dc
3 changed files with 10 additions and 7 deletions
|
@ -75,7 +75,7 @@ impl DiagnosticCollection {
|
|||
flycheck_id: usize,
|
||||
file_id: FileId,
|
||||
diagnostic: lsp_types::Diagnostic,
|
||||
fix: Option<Fix>,
|
||||
fix: Option<Box<Fix>>,
|
||||
) {
|
||||
let diagnostics = self.check.entry(flycheck_id).or_default().entry(file_id).or_default();
|
||||
for existing_diagnostic in diagnostics.iter() {
|
||||
|
@ -84,8 +84,10 @@ impl DiagnosticCollection {
|
|||
}
|
||||
}
|
||||
|
||||
let check_fixes = Arc::make_mut(&mut self.check_fixes);
|
||||
check_fixes.entry(flycheck_id).or_default().entry(file_id).or_default().extend(fix);
|
||||
if let Some(fix) = fix {
|
||||
let check_fixes = Arc::make_mut(&mut self.check_fixes);
|
||||
check_fixes.entry(flycheck_id).or_default().entry(file_id).or_default().push(*fix);
|
||||
}
|
||||
diagnostics.push(diagnostic);
|
||||
self.changes.insert(file_id);
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ fn resolve_path(
|
|||
|
||||
struct SubDiagnostic {
|
||||
related: lsp_types::DiagnosticRelatedInformation,
|
||||
suggested_fix: Option<Fix>,
|
||||
suggested_fix: Option<Box<Fix>>,
|
||||
}
|
||||
|
||||
enum MappedRustChildDiagnostic {
|
||||
|
@ -241,7 +241,7 @@ fn map_rust_child_diagnostic(
|
|||
location: location(config, workspace_root, spans[0], snap),
|
||||
message: message.clone(),
|
||||
},
|
||||
suggested_fix: Some(Fix {
|
||||
suggested_fix: Some(Box::new(Fix {
|
||||
ranges: spans
|
||||
.iter()
|
||||
.map(|&span| location(config, workspace_root, span, snap).range)
|
||||
|
@ -260,7 +260,7 @@ fn map_rust_child_diagnostic(
|
|||
data: None,
|
||||
command: None,
|
||||
},
|
||||
}),
|
||||
})),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ fn map_rust_child_diagnostic(
|
|||
pub(crate) struct MappedRustDiagnostic {
|
||||
pub(crate) url: lsp_types::Url,
|
||||
pub(crate) diagnostic: lsp_types::Diagnostic,
|
||||
pub(crate) fix: Option<Fix>,
|
||||
pub(crate) fix: Option<Box<Fix>>,
|
||||
}
|
||||
|
||||
/// Converts a Rust root diagnostic to LSP form
|
||||
|
|
|
@ -218,6 +218,7 @@ struct FlycheckActor {
|
|||
status: FlycheckStatus,
|
||||
}
|
||||
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
enum Event {
|
||||
RequestStateChange(StateChange),
|
||||
CheckEvent(Option<CargoCheckMessage>),
|
||||
|
|
Loading…
Reference in a new issue