File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -303,11 +303,9 @@ impl<'db> Completion<'db> {
303303 }
304304}
305305
306- // TODO: Not sure about this. I need to pass the deprecated value to relevance and this seems
307- // like the way
308- #[ expect( clippy:: struct_excessive_bools) ]
309306/// A builder for construction a `Completion`.
310307#[ derive( Debug ) ]
308+ #[ expect( clippy:: struct_excessive_bools) ]
311309struct CompletionBuilder < ' db > {
312310 // See comments on `Completion` for the meaning of fields.
313311 name : Name ,
@@ -420,13 +418,7 @@ impl<'db> CompletionBuilder<'db> {
420418 ) ;
421419 }
422420
423- self . deprecated = {
424- match ty {
425- Type :: FunctionLiteral ( f) => f. implementation_deprecated ( db) . is_some ( ) ,
426- Type :: ClassLiteral ( c) => c. deprecated ( db) . is_some ( ) ,
427- _ => false ,
428- }
429- } ;
421+ self . deprecated = ty. is_deprecated ( db) ;
430422 }
431423 let kind = self
432424 . kind
Original file line number Diff line number Diff line change @@ -1053,6 +1053,15 @@ impl<'db> Type<'db> {
10531053 }
10541054 }
10551055
1056+ /// Returns whether this type is marked as deprecated via `@warnings.deprecated`.
1057+ pub fn is_deprecated(&self, db: &'db dyn Db) -> bool {
1058+ match self {
1059+ Type::FunctionLiteral(f) => f.implementation_deprecated(db).is_some(),
1060+ Type::ClassLiteral(c) => c.deprecated(db).is_some(),
1061+ _ => false,
1062+ }
1063+ }
1064+
10561065 /// If the type is a specialized instance of the given `KnownClass`, returns the specialization.
10571066 pub(crate) fn known_specialization(
10581067 &self,
Original file line number Diff line number Diff line change @@ -581,7 +581,7 @@ impl<'db> ClassLiteral<'db> {
581581 }
582582
583583 /// Returns the deprecated info if this class is deprecated.
584- pub fn deprecated ( self , db : & ' db dyn Db ) -> Option < DeprecatedInstance < ' db > > {
584+ pub ( crate ) fn deprecated ( self , db : & ' db dyn Db ) -> Option < DeprecatedInstance < ' db > > {
585585 self . as_static ( ) . and_then ( |class| class. deprecated ( db) )
586586 }
587587
Original file line number Diff line number Diff line change @@ -1009,7 +1009,10 @@ impl<'db> FunctionType<'db> {
10091009 /// If the implementation of this function is deprecated, returns the `@warnings.deprecated`.
10101010 ///
10111011 /// Checking if an overload is deprecated requires deeper call analysis.
1012- pub fn implementation_deprecated ( self , db : & ' db dyn Db ) -> Option < DeprecatedInstance < ' db > > {
1012+ pub ( crate ) fn implementation_deprecated (
1013+ self ,
1014+ db : & ' db dyn Db ,
1015+ ) -> Option < DeprecatedInstance < ' db > > {
10131016 self . literal ( db) . implementation_deprecated ( db)
10141017 }
10151018
You can’t perform that action at this time.
0 commit comments