diff --git a/crates/rust-analyzer/src/diagnostics/test_data/clippy_pass_by_ref.txt b/crates/rust-analyzer/src/diagnostics/test_data/clippy_pass_by_ref.txt index 7576097b31f..ce80476fbc9 100644 --- a/crates/rust-analyzer/src/diagnostics/test_data/clippy_pass_by_ref.txt +++ b/crates/rust-analyzer/src/diagnostics/test_data/clippy_pass_by_ref.txt @@ -266,6 +266,51 @@ tags: None, data: None, }, - fixes: [], + fixes: [ + CodeAction { + title: "consider passing by value instead", + group: None, + kind: Some( + CodeActionKind( + "quickfix", + ), + ), + edit: Some( + SnippetWorkspaceEdit { + changes: Some( + { + Url { + scheme: "file", + host: None, + port: None, + path: "/test/compiler/mir/tagset.rs", + query: None, + fragment: None, + }: [ + TextEdit { + range: Range { + start: Position { + line: 41, + character: 23, + }, + end: Position { + line: 41, + character: 28, + }, + }, + new_text: "self", + }, + ], + }, + ), + document_changes: None, + }, + ), + is_preferred: Some( + true, + ), + data: None, + }, + ], }, ] diff --git a/crates/rust-analyzer/src/diagnostics/to_proto.rs b/crates/rust-analyzer/src/diagnostics/to_proto.rs index 757899484f1..0ed87fe3e09 100644 --- a/crates/rust-analyzer/src/diagnostics/to_proto.rs +++ b/crates/rust-analyzer/src/diagnostics/to_proto.rs @@ -2,7 +2,7 @@ //! `cargo check` json format to the LSP diagnostic format. use std::{collections::HashMap, path::Path}; -use flycheck::{Applicability, DiagnosticLevel, DiagnosticSpan}; +use flycheck::{DiagnosticLevel, DiagnosticSpan}; use stdx::format_to; use crate::{lsp_ext, to_proto::url_from_abs_path}; @@ -97,9 +97,7 @@ fn map_rust_child_diagnostic( let mut edit_map: HashMap> = HashMap::new(); for &span in &spans { - if let (Some(Applicability::MachineApplicable), Some(suggested_replacement)) = - (&span.suggestion_applicability, &span.suggested_replacement) - { + if let Some(suggested_replacement) = &span.suggested_replacement { let location = location(workspace_root, span); let edit = lsp_types::TextEdit::new(location.range, suggested_replacement.clone()); edit_map.entry(location.uri).or_default().push(edit);