@@ -73,7 +73,7 @@ use crate::rules::pyflakes::rules::{
7373use crate :: rules:: pylint:: rules:: { AwaitOutsideAsync , LoadBeforeGlobalDeclaration } ;
7474use crate :: rules:: { flake8_pyi, flake8_type_checking, pyflakes, pyupgrade} ;
7575use crate :: settings:: { LinterSettings , TargetVersion , flags} ;
76- use crate :: { Diagnostic , Edit , Violation } ;
76+ use crate :: { Edit , OldDiagnostic , Violation } ;
7777use crate :: { Locator , docstrings, noqa} ;
7878
7979mod analyze;
@@ -225,7 +225,7 @@ pub(crate) struct Checker<'a> {
225225 /// A set of deferred nodes to be analyzed after the AST traversal (e.g., `for` loops).
226226 analyze : deferred:: Analyze ,
227227 /// The cumulative set of diagnostics computed across all lint rules.
228- diagnostics : RefCell < Vec < Diagnostic > > ,
228+ diagnostics : RefCell < Vec < OldDiagnostic > > ,
229229 /// The list of names already seen by flake8-bugbear diagnostics, to avoid duplicate violations.
230230 flake8_bugbear_seen : RefCell < FxHashSet < TextRange > > ,
231231 /// The end offset of the last visited statement.
@@ -391,7 +391,7 @@ impl<'a> Checker<'a> {
391391 ) -> DiagnosticGuard < ' chk , ' a > {
392392 DiagnosticGuard {
393393 checker : self ,
394- diagnostic : Some ( Diagnostic :: new ( kind, range) ) ,
394+ diagnostic : Some ( OldDiagnostic :: new ( kind, range) ) ,
395395 }
396396 }
397397
@@ -405,7 +405,7 @@ impl<'a> Checker<'a> {
405405 kind : T ,
406406 range : TextRange ,
407407 ) -> Option < DiagnosticGuard < ' chk , ' a > > {
408- let diagnostic = Diagnostic :: new ( kind, range) ;
408+ let diagnostic = OldDiagnostic :: new ( kind, range) ;
409409 if self . enabled ( diagnostic. rule ( ) ) {
410410 Some ( DiagnosticGuard {
411411 checker : self ,
@@ -2892,7 +2892,7 @@ impl<'a> Checker<'a> {
28922892 if self . semantic . global_scope ( ) . uses_star_imports ( ) {
28932893 if self . enabled ( Rule :: UndefinedLocalWithImportStarUsage ) {
28942894 self . diagnostics . get_mut ( ) . push (
2895- Diagnostic :: new (
2895+ OldDiagnostic :: new (
28962896 pyflakes:: rules:: UndefinedLocalWithImportStarUsage {
28972897 name : name. to_string ( ) ,
28982898 } ,
@@ -2907,7 +2907,7 @@ impl<'a> Checker<'a> {
29072907 || !self . path . ends_with ( "__init__.py" )
29082908 {
29092909 self . diagnostics . get_mut ( ) . push (
2910- Diagnostic :: new (
2910+ OldDiagnostic :: new (
29112911 pyflakes:: rules:: UndefinedExport {
29122912 name : name. to_string ( ) ,
29132913 } ,
@@ -2975,7 +2975,7 @@ pub(crate) fn check_ast(
29752975 cell_offsets : Option < & CellOffsets > ,
29762976 notebook_index : Option < & NotebookIndex > ,
29772977 target_version : TargetVersion ,
2978- ) -> ( Vec < Diagnostic > , Vec < SemanticSyntaxError > ) {
2978+ ) -> ( Vec < OldDiagnostic > , Vec < SemanticSyntaxError > ) {
29792979 let module_path = package
29802980 . map ( PackageRoot :: path)
29812981 . and_then ( |package| to_module_path ( package, path) ) ;
@@ -3062,7 +3062,7 @@ pub(crate) struct DiagnosticGuard<'a, 'b> {
30623062 /// The diagnostic that we want to report.
30633063 ///
30643064 /// This is always `Some` until the `Drop` (or `defuse`) call.
3065- diagnostic : Option < Diagnostic > ,
3065+ diagnostic : Option < OldDiagnostic > ,
30663066}
30673067
30683068impl DiagnosticGuard < ' _ , ' _ > {
@@ -3076,17 +3076,17 @@ impl DiagnosticGuard<'_, '_> {
30763076}
30773077
30783078impl std:: ops:: Deref for DiagnosticGuard < ' _ , ' _ > {
3079- type Target = Diagnostic ;
3079+ type Target = OldDiagnostic ;
30803080
3081- fn deref ( & self ) -> & Diagnostic {
3081+ fn deref ( & self ) -> & OldDiagnostic {
30823082 // OK because `self.diagnostic` is only `None` within `Drop`.
30833083 self . diagnostic . as_ref ( ) . unwrap ( )
30843084 }
30853085}
30863086
30873087/// Return a mutable borrow of the diagnostic in this guard.
30883088impl std:: ops:: DerefMut for DiagnosticGuard < ' _ , ' _ > {
3089- fn deref_mut ( & mut self ) -> & mut Diagnostic {
3089+ fn deref_mut ( & mut self ) -> & mut OldDiagnostic {
30903090 // OK because `self.diagnostic` is only `None` within `Drop`.
30913091 self . diagnostic . as_mut ( ) . unwrap ( )
30923092 }
0 commit comments