mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Replace SmolStr usage with lang item enum for lang items
This commit is contained in:
parent
1afa032f34
commit
1535881836
21 changed files with 432 additions and 193 deletions
|
@ -4,6 +4,7 @@ use hir_def::{
|
|||
generics::{
|
||||
TypeOrConstParamData, TypeParamProvenance, WherePredicate, WherePredicateTypeTarget,
|
||||
},
|
||||
lang_item::LangItem,
|
||||
type_ref::{TypeBound, TypeRef},
|
||||
AdtId, GenericDefId,
|
||||
};
|
||||
|
@ -14,7 +15,6 @@ use hir_ty::{
|
|||
},
|
||||
Interner, TraitRefExt, WhereClause,
|
||||
};
|
||||
use syntax::SmolStr;
|
||||
|
||||
use crate::{
|
||||
Adt, Const, ConstParam, Enum, Field, Function, GenericParam, HasCrate, HasVisibility,
|
||||
|
@ -261,8 +261,7 @@ impl HirDisplay for TypeParam {
|
|||
bounds.iter().cloned().map(|b| b.substitute(Interner, &substs)).collect();
|
||||
let krate = self.id.parent().krate(f.db).id;
|
||||
let sized_trait =
|
||||
f.db.lang_item(krate, SmolStr::new_inline("sized"))
|
||||
.and_then(|lang_item| lang_item.as_trait());
|
||||
f.db.lang_item(krate, LangItem::Sized).and_then(|lang_item| lang_item.as_trait());
|
||||
let has_only_sized_bound = predicates.iter().all(move |pred| match pred.skip_binders() {
|
||||
WhereClause::Implemented(it) => Some(it.hir_trait_id()) == sized_trait,
|
||||
_ => false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue