aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-05-27 07:42:04 +0100
committerGitHub <[email protected]>2020-05-27 07:42:04 +0100
commit64a1c77ab279a2baddab25ae86698ece2bc146da (patch)
treef2831210d926dfdff58cd3d2676cf894eb565bfe /crates/ra_hir/src
parent7ddc3b468acc82192a665cdaa5b237167524f834 (diff)
parentbee4f8f9fee56bb00b462cdf4ad3ed317fed682f (diff)
Merge #4622
4622: Pass trivially copy types as copy r=matklad a=kjeremy Co-authored-by: kjeremy <[email protected]>
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/code_model.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index 840cfdfc8..8d7937d94 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -532,7 +532,7 @@ impl Adt {
532 Some(self.module(db).krate()) 532 Some(self.module(db).krate())
533 } 533 }
534 534
535 pub fn name(&self, db: &dyn HirDatabase) -> Name { 535 pub fn name(self, db: &dyn HirDatabase) -> Name {
536 match self { 536 match self {
537 Adt::Struct(s) => s.name(db), 537 Adt::Struct(s) => s.name(db),
538 Adt::Union(u) => u.name(db), 538 Adt::Union(u) => u.name(db),
@@ -1018,15 +1018,15 @@ impl ImplDef {
1018 impls.lookup_impl_defs_for_trait(trait_.id).map(Self::from).collect() 1018 impls.lookup_impl_defs_for_trait(trait_.id).map(Self::from).collect()
1019 } 1019 }
1020 1020
1021 pub fn target_trait(&self, db: &dyn HirDatabase) -> Option<TypeRef> { 1021 pub fn target_trait(self, db: &dyn HirDatabase) -> Option<TypeRef> {
1022 db.impl_data(self.id).target_trait.clone() 1022 db.impl_data(self.id).target_trait.clone()
1023 } 1023 }
1024 1024
1025 pub fn target_type(&self, db: &dyn HirDatabase) -> TypeRef { 1025 pub fn target_type(self, db: &dyn HirDatabase) -> TypeRef {
1026 db.impl_data(self.id).target_type.clone() 1026 db.impl_data(self.id).target_type.clone()
1027 } 1027 }
1028 1028
1029 pub fn target_ty(&self, db: &dyn HirDatabase) -> Type { 1029 pub fn target_ty(self, db: &dyn HirDatabase) -> Type {
1030 let impl_data = db.impl_data(self.id); 1030 let impl_data = db.impl_data(self.id);
1031 let resolver = self.id.resolver(db.upcast()); 1031 let resolver = self.id.resolver(db.upcast());
1032 let ctx = hir_ty::TyLoweringContext::new(db, &resolver); 1032 let ctx = hir_ty::TyLoweringContext::new(db, &resolver);
@@ -1038,23 +1038,23 @@ impl ImplDef {
1038 } 1038 }
1039 } 1039 }
1040 1040
1041 pub fn items(&self, db: &dyn HirDatabase) -> Vec<AssocItem> { 1041 pub fn items(self, db: &dyn HirDatabase) -> Vec<AssocItem> {
1042 db.impl_data(self.id).items.iter().map(|it| (*it).into()).collect() 1042 db.impl_data(self.id).items.iter().map(|it| (*it).into()).collect()
1043 } 1043 }
1044 1044
1045 pub fn is_negative(&self, db: &dyn HirDatabase) -> bool { 1045 pub fn is_negative(self, db: &dyn HirDatabase) -> bool {
1046 db.impl_data(self.id).is_negative 1046 db.impl_data(self.id).is_negative
1047 } 1047 }
1048 1048
1049 pub fn module(&self, db: &dyn HirDatabase) -> Module { 1049 pub fn module(self, db: &dyn HirDatabase) -> Module {
1050 self.id.lookup(db.upcast()).container.module(db.upcast()).into() 1050 self.id.lookup(db.upcast()).container.module(db.upcast()).into()
1051 } 1051 }
1052 1052
1053 pub fn krate(&self, db: &dyn HirDatabase) -> Crate { 1053 pub fn krate(self, db: &dyn HirDatabase) -> Crate {
1054 Crate { id: self.module(db).id.krate } 1054 Crate { id: self.module(db).id.krate }
1055 } 1055 }
1056 1056
1057 pub fn is_builtin_derive(&self, db: &dyn HirDatabase) -> Option<InFile<ast::Attr>> { 1057 pub fn is_builtin_derive(self, db: &dyn HirDatabase) -> Option<InFile<ast::Attr>> {
1058 let src = self.source(db); 1058 let src = self.source(db);
1059 let item = src.file_id.is_builtin_derive(db.upcast())?; 1059 let item = src.file_id.is_builtin_derive(db.upcast())?;
1060 let hygenic = hir_expand::hygiene::Hygiene::new(db.upcast(), item.file_id); 1060 let hygenic = hir_expand::hygiene::Hygiene::new(db.upcast(), item.file_id);