From b404b91da68556141ad39fffcef2865f073dd3d1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 13 Jun 2021 22:11:33 +0300 Subject: minor: dead code --- crates/ide/src/diagnostics/field_shorthand.rs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'crates/ide/src/diagnostics') diff --git a/crates/ide/src/diagnostics/field_shorthand.rs b/crates/ide/src/diagnostics/field_shorthand.rs index e885a398e..c7f4dab8e 100644 --- a/crates/ide/src/diagnostics/field_shorthand.rs +++ b/crates/ide/src/diagnostics/field_shorthand.rs @@ -5,7 +5,7 @@ use ide_db::{base_db::FileId, source_change::SourceChange}; use syntax::{ast, match_ast, AstNode, SyntaxNode}; use text_edit::TextEdit; -use crate::{diagnostics::fix, Diagnostic}; +use crate::{diagnostics::fix, Diagnostic, Severity}; pub(super) fn check(acc: &mut Vec, file_id: FileId, node: &SyntaxNode) { match_ast! { @@ -46,7 +46,8 @@ fn check_expr_field_shorthand( let field_range = record_field.syntax().text_range(); acc.push( - Diagnostic::hint(field_range, "Shorthand struct initialization".to_string()) + Diagnostic::new("use-field-shorthand", "Shorthand struct initialization", field_range) + .severity(Severity::WeakWarning) .with_fixes(Some(vec![fix( "use_expr_field_shorthand", "Use struct shorthand initialization", @@ -85,14 +86,16 @@ fn check_pat_field_shorthand( let edit = edit_builder.finish(); let field_range = record_pat_field.syntax().text_range(); - acc.push(Diagnostic::hint(field_range, "Shorthand struct pattern".to_string()).with_fixes( - Some(vec![fix( - "use_pat_field_shorthand", - "Use struct field shorthand", - SourceChange::from_text_edit(file_id, edit), - field_range, - )]), - )); + acc.push( + Diagnostic::new("use-field-shorthand", "Shorthand struct pattern", field_range) + .severity(Severity::WeakWarning) + .with_fixes(Some(vec![fix( + "use_pat_field_shorthand", + "Use struct field shorthand", + SourceChange::from_text_edit(file_id, edit), + field_range, + )])), + ); } } -- cgit v1.2.3