mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 20:43:21 +00:00
Add new type-mismatch diagnostic
This commit is contained in:
parent
2d30dd67d3
commit
ab3313b1cb
7 changed files with 151 additions and 81 deletions
|
@ -28,7 +28,6 @@ macro_rules! diagnostics {
|
||||||
}
|
}
|
||||||
|
|
||||||
diagnostics![
|
diagnostics![
|
||||||
AddReferenceHere,
|
|
||||||
BreakOutsideOfLoop,
|
BreakOutsideOfLoop,
|
||||||
InactiveCode,
|
InactiveCode,
|
||||||
IncorrectCase,
|
IncorrectCase,
|
||||||
|
@ -38,11 +37,10 @@ diagnostics![
|
||||||
MismatchedArgCount,
|
MismatchedArgCount,
|
||||||
MissingFields,
|
MissingFields,
|
||||||
MissingMatchArms,
|
MissingMatchArms,
|
||||||
MissingOkOrSomeInTailExpr,
|
|
||||||
MissingUnsafe,
|
MissingUnsafe,
|
||||||
NoSuchField,
|
NoSuchField,
|
||||||
RemoveThisSemicolon,
|
|
||||||
ReplaceFilterMapNextWithFindMap,
|
ReplaceFilterMapNextWithFindMap,
|
||||||
|
TypeMismatch,
|
||||||
UnimplementedBuiltinMacro,
|
UnimplementedBuiltinMacro,
|
||||||
UnresolvedExternCrate,
|
UnresolvedExternCrate,
|
||||||
UnresolvedImport,
|
UnresolvedImport,
|
||||||
|
@ -147,19 +145,6 @@ pub struct MismatchedArgCount {
|
||||||
pub found: usize,
|
pub found: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct RemoveThisSemicolon {
|
|
||||||
pub expr: InFile<AstPtr<ast::Expr>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct MissingOkOrSomeInTailExpr {
|
|
||||||
pub expr: InFile<AstPtr<ast::Expr>>,
|
|
||||||
// `Some` or `Ok` depending on whether the return type is Result or Option
|
|
||||||
pub required: String,
|
|
||||||
pub expected: Type,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct MissingMatchArms {
|
pub struct MissingMatchArms {
|
||||||
pub file: HirFileId,
|
pub file: HirFileId,
|
||||||
|
@ -167,9 +152,10 @@ pub struct MissingMatchArms {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct AddReferenceHere {
|
pub struct TypeMismatch {
|
||||||
pub expr: InFile<AstPtr<ast::Expr>>,
|
pub expr: InFile<AstPtr<ast::Expr>>,
|
||||||
pub mutability: Mutability,
|
pub expected: Type,
|
||||||
|
pub actual: Type,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub use hir_ty::diagnostics::IncorrectCase;
|
pub use hir_ty::diagnostics::IncorrectCase;
|
||||||
|
|
|
@ -85,12 +85,11 @@ use crate::db::{DefDatabase, HirDatabase};
|
||||||
pub use crate::{
|
pub use crate::{
|
||||||
attrs::{HasAttrs, Namespace},
|
attrs::{HasAttrs, Namespace},
|
||||||
diagnostics::{
|
diagnostics::{
|
||||||
AddReferenceHere, AnyDiagnostic, BreakOutsideOfLoop, InactiveCode, IncorrectCase,
|
AnyDiagnostic, BreakOutsideOfLoop, InactiveCode, IncorrectCase, InvalidDeriveTarget,
|
||||||
InvalidDeriveTarget, MacroError, MalformedDerive, MismatchedArgCount, MissingFields,
|
MacroError, MalformedDerive, MismatchedArgCount, MissingFields, MissingMatchArms,
|
||||||
MissingMatchArms, MissingOkOrSomeInTailExpr, MissingUnsafe, NoSuchField,
|
MissingUnsafe, NoSuchField, ReplaceFilterMapNextWithFindMap, TypeMismatch,
|
||||||
RemoveThisSemicolon, ReplaceFilterMapNextWithFindMap, UnimplementedBuiltinMacro,
|
UnimplementedBuiltinMacro, UnresolvedExternCrate, UnresolvedImport, UnresolvedMacroCall,
|
||||||
UnresolvedExternCrate, UnresolvedImport, UnresolvedMacroCall, UnresolvedModule,
|
UnresolvedModule, UnresolvedProcMacro,
|
||||||
UnresolvedProcMacro,
|
|
||||||
},
|
},
|
||||||
has_source::HasSource,
|
has_source::HasSource,
|
||||||
semantics::{PathResolution, Semantics, SemanticsScope, TypeInfo},
|
semantics::{PathResolution, Semantics, SemanticsScope, TypeInfo},
|
||||||
|
@ -1163,6 +1162,28 @@ impl DefWithBody {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (expr, mismatch) in infer.expr_type_mismatches() {
|
||||||
|
let expr =
|
||||||
|
source_map.expr_syntax(expr).expect("break outside of loop in synthetic syntax");
|
||||||
|
acc.push(
|
||||||
|
TypeMismatch {
|
||||||
|
expr,
|
||||||
|
expected: Type::new(
|
||||||
|
db,
|
||||||
|
krate,
|
||||||
|
DefWithBodyId::from(self),
|
||||||
|
mismatch.expected.clone(),
|
||||||
|
),
|
||||||
|
actual: Type::new(
|
||||||
|
db,
|
||||||
|
krate,
|
||||||
|
DefWithBodyId::from(self),
|
||||||
|
mismatch.actual.clone(),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
.into(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
for expr in hir_ty::diagnostics::missing_unsafe(db, self.into()) {
|
for expr in hir_ty::diagnostics::missing_unsafe(db, self.into()) {
|
||||||
match source_map.expr_syntax(expr) {
|
match source_map.expr_syntax(expr) {
|
||||||
|
@ -1259,25 +1280,6 @@ impl DefWithBody {
|
||||||
Err(SyntheticSyntax) => (),
|
Err(SyntheticSyntax) => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BodyValidationDiagnostic::RemoveThisSemicolon { expr } => {
|
|
||||||
match source_map.expr_syntax(expr) {
|
|
||||||
Ok(expr) => acc.push(RemoveThisSemicolon { expr }.into()),
|
|
||||||
Err(SyntheticSyntax) => (),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
BodyValidationDiagnostic::MissingOkOrSomeInTailExpr { expr, required } => {
|
|
||||||
match source_map.expr_syntax(expr) {
|
|
||||||
Ok(expr) => acc.push(
|
|
||||||
MissingOkOrSomeInTailExpr {
|
|
||||||
expr,
|
|
||||||
required,
|
|
||||||
expected: self.body_type(db),
|
|
||||||
}
|
|
||||||
.into(),
|
|
||||||
),
|
|
||||||
Err(SyntheticSyntax) => (),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
BodyValidationDiagnostic::MissingMatchArms { match_expr } => {
|
BodyValidationDiagnostic::MissingMatchArms { match_expr } => {
|
||||||
match source_map.expr_syntax(match_expr) {
|
match source_map.expr_syntax(match_expr) {
|
||||||
Ok(source_ptr) => {
|
Ok(source_ptr) => {
|
||||||
|
@ -1299,12 +1301,7 @@ impl DefWithBody {
|
||||||
Err(SyntheticSyntax) => (),
|
Err(SyntheticSyntax) => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BodyValidationDiagnostic::AddReferenceHere { arg_expr, mutability } => {
|
_ => {} // TODO fixme
|
||||||
match source_map.expr_syntax(arg_expr) {
|
|
||||||
Ok(expr) => acc.push(AddReferenceHere { expr, mutability }.into()),
|
|
||||||
Err(SyntheticSyntax) => (),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2618,6 +2615,14 @@ impl Type {
|
||||||
Type { krate, env: environment, ty }
|
Type { krate, env: environment, ty }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn reference(inner: &Type, m: Mutability) -> Type {
|
||||||
|
inner.derived(TyKind::Ref(
|
||||||
|
if m.is_mut() { hir_ty::Mutability::Mut } else { hir_ty::Mutability::Not },
|
||||||
|
hir_ty::static_lifetime(),
|
||||||
|
inner.ty.clone(),
|
||||||
|
).intern(Interner))
|
||||||
|
}
|
||||||
|
|
||||||
fn new(db: &dyn HirDatabase, krate: CrateId, lexical_env: impl HasResolver, ty: Ty) -> Type {
|
fn new(db: &dyn HirDatabase, krate: CrateId, lexical_env: impl HasResolver, ty: Ty) -> Type {
|
||||||
let resolver = lexical_env.resolver(db.upcast());
|
let resolver = lexical_env.resolver(db.upcast());
|
||||||
let environment = resolver
|
let environment = resolver
|
||||||
|
@ -2659,6 +2664,12 @@ impl Type {
|
||||||
matches!(self.ty.kind(Interner), TyKind::Ref(..))
|
matches!(self.ty.kind(Interner), TyKind::Ref(..))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn as_reference(&self) -> Option<(Type, Mutability)> {
|
||||||
|
let (ty, _lt, m) = self.ty.as_reference()?;
|
||||||
|
let m = Mutability::from_mutable(matches!(m, hir_ty::Mutability::Mut));
|
||||||
|
Some((self.derived(ty.clone()), m))
|
||||||
|
}
|
||||||
|
|
||||||
pub fn is_slice(&self) -> bool {
|
pub fn is_slice(&self) -> bool {
|
||||||
matches!(self.ty.kind(Interner), TyKind::Slice(..))
|
matches!(self.ty.kind(Interner), TyKind::Slice(..))
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,22 @@ impl Mutability {
|
||||||
Mutability::Mut => "mut ",
|
Mutability::Mut => "mut ",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns `true` if the mutability is [`Mut`].
|
||||||
|
///
|
||||||
|
/// [`Mut`]: Mutability::Mut
|
||||||
|
#[must_use]
|
||||||
|
pub fn is_mut(&self) -> bool {
|
||||||
|
matches!(self, Self::Mut)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns `true` if the mutability is [`Shared`].
|
||||||
|
///
|
||||||
|
/// [`Shared`]: Mutability::Shared
|
||||||
|
#[must_use]
|
||||||
|
pub fn is_shared(&self) -> bool {
|
||||||
|
matches!(self, Self::Shared)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
|
||||||
|
|
|
@ -108,13 +108,13 @@ mod tests {
|
||||||
check_diagnostics(
|
check_diagnostics(
|
||||||
r#"
|
r#"
|
||||||
struct A { a: &'static str }
|
struct A { a: &'static str }
|
||||||
fn main() { A { a: "hello" } }
|
fn main() { A { a: "hello" }; }
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
check_diagnostics(
|
check_diagnostics(
|
||||||
r#"
|
r#"
|
||||||
struct A(usize);
|
struct A(usize);
|
||||||
fn main() { A { 0: 0 } }
|
fn main() { A { 0: 0 }; }
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -123,14 +123,14 @@ fn main() { A { 0: 0 } }
|
||||||
struct A { a: &'static str }
|
struct A { a: &'static str }
|
||||||
fn main() {
|
fn main() {
|
||||||
let a = "haha";
|
let a = "haha";
|
||||||
A { a$0: a }
|
A { a$0: a };
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
r#"
|
r#"
|
||||||
struct A { a: &'static str }
|
struct A { a: &'static str }
|
||||||
fn main() {
|
fn main() {
|
||||||
let a = "haha";
|
let a = "haha";
|
||||||
A { a }
|
A { a };
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
|
@ -141,7 +141,7 @@ struct A { a: &'static str, b: &'static str }
|
||||||
fn main() {
|
fn main() {
|
||||||
let a = "haha";
|
let a = "haha";
|
||||||
let b = "bb";
|
let b = "bb";
|
||||||
A { a$0: a, b }
|
A { a$0: a, b };
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
r#"
|
r#"
|
||||||
|
@ -149,7 +149,7 @@ struct A { a: &'static str, b: &'static str }
|
||||||
fn main() {
|
fn main() {
|
||||||
let a = "haha";
|
let a = "haha";
|
||||||
let b = "bb";
|
let b = "bb";
|
||||||
A { a, b }
|
A { a, b };
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
|
|
|
@ -278,6 +278,7 @@ fn main() {
|
||||||
match (true, false) {
|
match (true, false) {
|
||||||
(true, false, true) => (),
|
(true, false, true) => (),
|
||||||
(true) => (),
|
(true) => (),
|
||||||
|
// ^^^^ error: expected (bool, bool), found bool
|
||||||
}
|
}
|
||||||
match (true, false) { (true,) => {} }
|
match (true, false) { (true,) => {} }
|
||||||
match (0) { () => () }
|
match (0) { () => () }
|
||||||
|
|
|
@ -1,37 +1,62 @@
|
||||||
use hir::db::AstDatabase;
|
use hir::{db::AstDatabase, HirDisplay, Type};
|
||||||
use ide_db::source_change::SourceChange;
|
use ide_db::source_change::SourceChange;
|
||||||
use syntax::AstNode;
|
use syntax::{AstNode, TextRange};
|
||||||
use text_edit::TextEdit;
|
use text_edit::TextEdit;
|
||||||
|
|
||||||
use crate::{fix, Assist, Diagnostic, DiagnosticsContext};
|
use crate::{fix, Assist, Diagnostic, DiagnosticsContext};
|
||||||
|
|
||||||
// Diagnostic: add-reference-here
|
// Diagnostic: type-mismatch
|
||||||
//
|
//
|
||||||
// This diagnostic is triggered when there's a missing referencing of expression.
|
// This diagnostic is triggered when the type of an expression does not match
|
||||||
pub(crate) fn add_reference_here(
|
// the expected type.
|
||||||
ctx: &DiagnosticsContext<'_>,
|
pub(crate) fn type_mismatch(ctx: &DiagnosticsContext<'_>, d: &hir::TypeMismatch) -> Diagnostic {
|
||||||
d: &hir::AddReferenceHere,
|
let mut diag = Diagnostic::new(
|
||||||
) -> Diagnostic {
|
"type-mismatch",
|
||||||
Diagnostic::new(
|
format!(
|
||||||
"add-reference-here",
|
"expected {}, found {}",
|
||||||
"add reference here",
|
d.expected.display(ctx.sema.db),
|
||||||
|
d.actual.display(ctx.sema.db)
|
||||||
|
),
|
||||||
ctx.sema.diagnostics_display_range(d.expr.clone().map(|it| it.into())).range,
|
ctx.sema.diagnostics_display_range(d.expr.clone().map(|it| it.into())).range,
|
||||||
)
|
)
|
||||||
.with_fixes(fixes(ctx, d))
|
.with_fixes(fixes(ctx, d));
|
||||||
|
if diag.fixes.is_none() {
|
||||||
|
diag.experimental = true;
|
||||||
|
}
|
||||||
|
diag
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fixes(ctx: &DiagnosticsContext<'_>, d: &hir::AddReferenceHere) -> Option<Vec<Assist>> {
|
fn fixes(ctx: &DiagnosticsContext<'_>, d: &hir::TypeMismatch) -> Option<Vec<Assist>> {
|
||||||
|
let mut fixes = Vec::new();
|
||||||
|
|
||||||
|
add_reference(ctx, d, &mut fixes);
|
||||||
|
|
||||||
|
if fixes.is_empty() {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(fixes)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn add_reference(ctx: &DiagnosticsContext<'_>, d: &hir::TypeMismatch, acc: &mut Vec<Assist>) -> Option<()> {
|
||||||
let root = ctx.sema.db.parse_or_expand(d.expr.file_id)?;
|
let root = ctx.sema.db.parse_or_expand(d.expr.file_id)?;
|
||||||
let arg_expr = d.expr.value.to_node(&root);
|
let expr_node = d.expr.value.to_node(&root);
|
||||||
|
|
||||||
let arg_with_ref = format!("&{}{}", d.mutability.as_keyword_for_ref(), arg_expr.syntax());
|
let range = ctx.sema.diagnostics_display_range(d.expr.clone().map(|it| it.into())).range;
|
||||||
|
|
||||||
let arg_range = arg_expr.syntax().text_range();
|
let (_, mutability) = d.expected.as_reference()?;
|
||||||
let edit = TextEdit::replace(arg_range, arg_with_ref);
|
let actual_with_ref = Type::reference(&d.actual, mutability);
|
||||||
|
if !actual_with_ref.could_coerce_to(ctx.sema.db, &d.expected) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
let ampersands = format!("&{}", mutability.as_keyword_for_ref());
|
||||||
|
|
||||||
|
let edit = TextEdit::insert(expr_node.syntax().text_range().start(), ampersands);
|
||||||
let source_change =
|
let source_change =
|
||||||
SourceChange::from_text_edit(d.expr.file_id.original_file(ctx.sema.db), edit);
|
SourceChange::from_text_edit(d.expr.file_id.original_file(ctx.sema.db), edit);
|
||||||
|
acc.push(fix("add_reference_here", "Add reference here", source_change, range));
|
||||||
Some(vec![fix("add_reference_here", "Add reference here", source_change, arg_range)])
|
Some(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
@ -44,7 +69,7 @@ mod tests {
|
||||||
r#"
|
r#"
|
||||||
fn main() {
|
fn main() {
|
||||||
test(123);
|
test(123);
|
||||||
//^^^ 💡 error: add reference here
|
//^^^ 💡 error: expected &i32, found i32
|
||||||
}
|
}
|
||||||
fn test(arg: &i32) {}
|
fn test(arg: &i32) {}
|
||||||
"#,
|
"#,
|
||||||
|
@ -91,6 +116,7 @@ fn test(arg: &mut i32) {}
|
||||||
fn test_add_reference_to_array() {
|
fn test_add_reference_to_array() {
|
||||||
check_fix(
|
check_fix(
|
||||||
r#"
|
r#"
|
||||||
|
//- minicore: coerce_unsized
|
||||||
fn main() {
|
fn main() {
|
||||||
test($0[1, 2, 3]);
|
test($0[1, 2, 3]);
|
||||||
}
|
}
|
||||||
|
@ -105,6 +131,37 @@ fn test(arg: &[i32]) {}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_add_reference_with_autoderef() {
|
||||||
|
check_fix(
|
||||||
|
r#"
|
||||||
|
//- minicore: coerce_unsized, deref
|
||||||
|
struct Foo;
|
||||||
|
struct Bar;
|
||||||
|
impl core::ops::Deref for Foo {
|
||||||
|
type Target = Bar;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
test($0Foo);
|
||||||
|
}
|
||||||
|
fn test(arg: &Bar) {}
|
||||||
|
"#,
|
||||||
|
r#"
|
||||||
|
struct Foo;
|
||||||
|
struct Bar;
|
||||||
|
impl core::ops::Deref for Foo {
|
||||||
|
type Target = Bar;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
test(&Foo);
|
||||||
|
}
|
||||||
|
fn test(arg: &Bar) {}
|
||||||
|
"#,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_add_reference_to_method_call() {
|
fn test_add_reference_to_method_call() {
|
||||||
check_fix(
|
check_fix(
|
|
@ -24,7 +24,7 @@
|
||||||
//! don't yet have a great pattern for how to do them properly.
|
//! don't yet have a great pattern for how to do them properly.
|
||||||
|
|
||||||
mod handlers {
|
mod handlers {
|
||||||
pub(crate) mod add_reference_here;
|
// pub(crate) mod add_reference_here;
|
||||||
pub(crate) mod break_outside_of_loop;
|
pub(crate) mod break_outside_of_loop;
|
||||||
pub(crate) mod inactive_code;
|
pub(crate) mod inactive_code;
|
||||||
pub(crate) mod incorrect_case;
|
pub(crate) mod incorrect_case;
|
||||||
|
@ -34,10 +34,10 @@ mod handlers {
|
||||||
pub(crate) mod mismatched_arg_count;
|
pub(crate) mod mismatched_arg_count;
|
||||||
pub(crate) mod missing_fields;
|
pub(crate) mod missing_fields;
|
||||||
pub(crate) mod missing_match_arms;
|
pub(crate) mod missing_match_arms;
|
||||||
pub(crate) mod missing_ok_or_some_in_tail_expr;
|
// pub(crate) mod missing_ok_or_some_in_tail_expr;
|
||||||
pub(crate) mod missing_unsafe;
|
pub(crate) mod missing_unsafe;
|
||||||
pub(crate) mod no_such_field;
|
pub(crate) mod no_such_field;
|
||||||
pub(crate) mod remove_this_semicolon;
|
// pub(crate) mod remove_this_semicolon;
|
||||||
pub(crate) mod replace_filter_map_next_with_find_map;
|
pub(crate) mod replace_filter_map_next_with_find_map;
|
||||||
pub(crate) mod unimplemented_builtin_macro;
|
pub(crate) mod unimplemented_builtin_macro;
|
||||||
pub(crate) mod unresolved_extern_crate;
|
pub(crate) mod unresolved_extern_crate;
|
||||||
|
@ -45,6 +45,7 @@ mod handlers {
|
||||||
pub(crate) mod unresolved_macro_call;
|
pub(crate) mod unresolved_macro_call;
|
||||||
pub(crate) mod unresolved_module;
|
pub(crate) mod unresolved_module;
|
||||||
pub(crate) mod unresolved_proc_macro;
|
pub(crate) mod unresolved_proc_macro;
|
||||||
|
pub(crate) mod type_mismatch;
|
||||||
|
|
||||||
// The handlers below are unusual, the implement the diagnostics as well.
|
// The handlers below are unusual, the implement the diagnostics as well.
|
||||||
pub(crate) mod field_shorthand;
|
pub(crate) mod field_shorthand;
|
||||||
|
@ -191,7 +192,6 @@ pub fn diagnostics(
|
||||||
for diag in diags {
|
for diag in diags {
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
let d = match diag {
|
let d = match diag {
|
||||||
AnyDiagnostic::AddReferenceHere(d) => handlers::add_reference_here::add_reference_here(&ctx, &d),
|
|
||||||
AnyDiagnostic::BreakOutsideOfLoop(d) => handlers::break_outside_of_loop::break_outside_of_loop(&ctx, &d),
|
AnyDiagnostic::BreakOutsideOfLoop(d) => handlers::break_outside_of_loop::break_outside_of_loop(&ctx, &d),
|
||||||
AnyDiagnostic::IncorrectCase(d) => handlers::incorrect_case::incorrect_case(&ctx, &d),
|
AnyDiagnostic::IncorrectCase(d) => handlers::incorrect_case::incorrect_case(&ctx, &d),
|
||||||
AnyDiagnostic::MacroError(d) => handlers::macro_error::macro_error(&ctx, &d),
|
AnyDiagnostic::MacroError(d) => handlers::macro_error::macro_error(&ctx, &d),
|
||||||
|
@ -199,11 +199,10 @@ pub fn diagnostics(
|
||||||
AnyDiagnostic::MismatchedArgCount(d) => handlers::mismatched_arg_count::mismatched_arg_count(&ctx, &d),
|
AnyDiagnostic::MismatchedArgCount(d) => handlers::mismatched_arg_count::mismatched_arg_count(&ctx, &d),
|
||||||
AnyDiagnostic::MissingFields(d) => handlers::missing_fields::missing_fields(&ctx, &d),
|
AnyDiagnostic::MissingFields(d) => handlers::missing_fields::missing_fields(&ctx, &d),
|
||||||
AnyDiagnostic::MissingMatchArms(d) => handlers::missing_match_arms::missing_match_arms(&ctx, &d),
|
AnyDiagnostic::MissingMatchArms(d) => handlers::missing_match_arms::missing_match_arms(&ctx, &d),
|
||||||
AnyDiagnostic::MissingOkOrSomeInTailExpr(d) => handlers::missing_ok_or_some_in_tail_expr::missing_ok_or_some_in_tail_expr(&ctx, &d),
|
|
||||||
AnyDiagnostic::MissingUnsafe(d) => handlers::missing_unsafe::missing_unsafe(&ctx, &d),
|
AnyDiagnostic::MissingUnsafe(d) => handlers::missing_unsafe::missing_unsafe(&ctx, &d),
|
||||||
AnyDiagnostic::NoSuchField(d) => handlers::no_such_field::no_such_field(&ctx, &d),
|
AnyDiagnostic::NoSuchField(d) => handlers::no_such_field::no_such_field(&ctx, &d),
|
||||||
AnyDiagnostic::RemoveThisSemicolon(d) => handlers::remove_this_semicolon::remove_this_semicolon(&ctx, &d),
|
|
||||||
AnyDiagnostic::ReplaceFilterMapNextWithFindMap(d) => handlers::replace_filter_map_next_with_find_map::replace_filter_map_next_with_find_map(&ctx, &d),
|
AnyDiagnostic::ReplaceFilterMapNextWithFindMap(d) => handlers::replace_filter_map_next_with_find_map::replace_filter_map_next_with_find_map(&ctx, &d),
|
||||||
|
AnyDiagnostic::TypeMismatch(d) => handlers::type_mismatch::type_mismatch(&ctx, &d),
|
||||||
AnyDiagnostic::UnimplementedBuiltinMacro(d) => handlers::unimplemented_builtin_macro::unimplemented_builtin_macro(&ctx, &d),
|
AnyDiagnostic::UnimplementedBuiltinMacro(d) => handlers::unimplemented_builtin_macro::unimplemented_builtin_macro(&ctx, &d),
|
||||||
AnyDiagnostic::UnresolvedExternCrate(d) => handlers::unresolved_extern_crate::unresolved_extern_crate(&ctx, &d),
|
AnyDiagnostic::UnresolvedExternCrate(d) => handlers::unresolved_extern_crate::unresolved_extern_crate(&ctx, &d),
|
||||||
AnyDiagnostic::UnresolvedImport(d) => handlers::unresolved_import::unresolved_import(&ctx, &d),
|
AnyDiagnostic::UnresolvedImport(d) => handlers::unresolved_import::unresolved_import(&ctx, &d),
|
||||||
|
|
Loading…
Reference in a new issue