From 8146669542dfc887956901b54a453c9a97fee7e3 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 18 Aug 2020 18:39:43 +0200 Subject: Add type safety to diagnostic codes --- crates/hir_def/src/diagnostics.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/hir_def') diff --git a/crates/hir_def/src/diagnostics.rs b/crates/hir_def/src/diagnostics.rs index c7723de00..3e19d9117 100644 --- a/crates/hir_def/src/diagnostics.rs +++ b/crates/hir_def/src/diagnostics.rs @@ -2,7 +2,7 @@ use std::any::Any; -use hir_expand::diagnostics::Diagnostic; +use hir_expand::diagnostics::{Diagnostic, DiagnosticCode}; use syntax::{ast, AstPtr, SyntaxNodePtr}; use hir_expand::{HirFileId, InFile}; @@ -15,8 +15,8 @@ pub struct UnresolvedModule { } impl Diagnostic for UnresolvedModule { - fn name(&self) -> &'static str { - "unresolved-module" + fn code(&self) -> DiagnosticCode { + DiagnosticCode("unresolved-module") } fn message(&self) -> String { "unresolved module".to_string() -- cgit v1.2.3