diff options
author | Alan Du <[email protected]> | 2019-06-03 15:21:08 +0100 |
---|---|---|
committer | Alan Du <[email protected]> | 2019-06-04 23:05:07 +0100 |
commit | 40424d4222d4630bc53294d10f1718f2d3d300de (patch) | |
tree | 4e27c7f2ce4a886e9a512b4986509b0927ae9ea1 /crates/ra_hir/src | |
parent | ed3d93b875f25da6f81b8a107a8c200311240627 (diff) |
Fix clippy::identity_conversion
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/adt.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/impl_block.rs | 1 | ||||
-rw-r--r-- | crates/ra_hir/src/nameres.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/nameres/collector.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/nameres/raw.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 11 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/infer.rs | 6 |
7 files changed, 11 insertions, 15 deletions
diff --git a/crates/ra_hir/src/adt.rs b/crates/ra_hir/src/adt.rs index 45a12dd4d..38ff1d6f6 100644 --- a/crates/ra_hir/src/adt.rs +++ b/crates/ra_hir/src/adt.rs | |||
@@ -36,7 +36,7 @@ impl AdtDef { | |||
36 | 36 | ||
37 | impl Struct { | 37 | impl Struct { |
38 | pub(crate) fn variant_data(&self, db: &impl DefDatabase) -> Arc<VariantData> { | 38 | pub(crate) fn variant_data(&self, db: &impl DefDatabase) -> Arc<VariantData> { |
39 | db.struct_data((*self).into()).variant_data.clone() | 39 | db.struct_data(*self).variant_data.clone() |
40 | } | 40 | } |
41 | } | 41 | } |
42 | 42 | ||
diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs index ba90e67e9..a0d3b33fe 100644 --- a/crates/ra_hir/src/impl_block.rs +++ b/crates/ra_hir/src/impl_block.rs | |||
@@ -202,7 +202,6 @@ impl ModuleImplBlocks { | |||
202 | }; | 202 | }; |
203 | 203 | ||
204 | let (file_id, module_source) = m.module.definition_source(db); | 204 | let (file_id, module_source) = m.module.definition_source(db); |
205 | let file_id: HirFileId = file_id.into(); | ||
206 | let node = match &module_source { | 205 | let node = match &module_source { |
207 | ModuleSource::SourceFile(node) => node.syntax(), | 206 | ModuleSource::SourceFile(node) => node.syntax(), |
208 | ModuleSource::Module(node) => { | 207 | ModuleSource::Module(node) => { |
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs index d649aa820..d822f7d93 100644 --- a/crates/ra_hir/src/nameres.rs +++ b/crates/ra_hir/src/nameres.rs | |||
@@ -468,7 +468,7 @@ impl CrateDefMap { | |||
468 | ); | 468 | ); |
469 | 469 | ||
470 | return ResolvePathResult::with( | 470 | return ResolvePathResult::with( |
471 | Either::Left(PerNs::types((*s).into())), | 471 | Either::Left(PerNs::types(*s)), |
472 | ReachedFixedPoint::Yes, | 472 | ReachedFixedPoint::Yes, |
473 | Some(i), | 473 | Some(i), |
474 | ); | 474 | ); |
diff --git a/crates/ra_hir/src/nameres/collector.rs b/crates/ra_hir/src/nameres/collector.rs index 693c3fe8e..3bfef799d 100644 --- a/crates/ra_hir/src/nameres/collector.rs +++ b/crates/ra_hir/src/nameres/collector.rs | |||
@@ -556,7 +556,7 @@ where | |||
556 | 556 | ||
557 | fn define_def(&mut self, def: &raw::DefData) { | 557 | fn define_def(&mut self, def: &raw::DefData) { |
558 | let module = Module { krate: self.def_collector.def_map.krate, module_id: self.module_id }; | 558 | let module = Module { krate: self.def_collector.def_map.krate, module_id: self.module_id }; |
559 | let ctx = LocationCtx::new(self.def_collector.db, module, self.file_id.into()); | 559 | let ctx = LocationCtx::new(self.def_collector.db, module, self.file_id); |
560 | 560 | ||
561 | macro_rules! def { | 561 | macro_rules! def { |
562 | ($kind:ident, $ast_id:ident) => { | 562 | ($kind:ident, $ast_id:ident) => { |
diff --git a/crates/ra_hir/src/nameres/raw.rs b/crates/ra_hir/src/nameres/raw.rs index 21935dbb9..a0afe282c 100644 --- a/crates/ra_hir/src/nameres/raw.rs +++ b/crates/ra_hir/src/nameres/raw.rs | |||
@@ -69,7 +69,7 @@ impl RawItems { | |||
69 | ) -> (Arc<RawItems>, Arc<ImportSourceMap>) { | 69 | ) -> (Arc<RawItems>, Arc<ImportSourceMap>) { |
70 | let mut collector = RawItemsCollector { | 70 | let mut collector = RawItemsCollector { |
71 | raw_items: RawItems::default(), | 71 | raw_items: RawItems::default(), |
72 | source_ast_id_map: db.ast_id_map(file_id.into()), | 72 | source_ast_id_map: db.ast_id_map(file_id), |
73 | source_map: ImportSourceMap::default(), | 73 | source_map: ImportSourceMap::default(), |
74 | }; | 74 | }; |
75 | if let Some(node) = db.parse_or_expand(file_id) { | 75 | if let Some(node) = db.parse_or_expand(file_id) { |
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 75ed2de6c..6a5799622 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -48,8 +48,8 @@ pub fn module_from_declaration( | |||
48 | pub fn module_from_position(db: &impl HirDatabase, position: FilePosition) -> Option<Module> { | 48 | pub fn module_from_position(db: &impl HirDatabase, position: FilePosition) -> Option<Module> { |
49 | let file = db.parse(position.file_id).tree; | 49 | let file = db.parse(position.file_id).tree; |
50 | match find_node_at_offset::<ast::Module>(file.syntax(), position.offset) { | 50 | match find_node_at_offset::<ast::Module>(file.syntax(), position.offset) { |
51 | Some(m) if !m.has_semi() => module_from_inline(db, position.file_id.into(), m), | 51 | Some(m) if !m.has_semi() => module_from_inline(db, position.file_id, m), |
52 | _ => module_from_file_id(db, position.file_id.into()), | 52 | _ => module_from_file_id(db, position.file_id), |
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
@@ -72,9 +72,9 @@ pub fn module_from_child_node( | |||
72 | child: &SyntaxNode, | 72 | child: &SyntaxNode, |
73 | ) -> Option<Module> { | 73 | ) -> Option<Module> { |
74 | if let Some(m) = child.ancestors().filter_map(ast::Module::cast).find(|it| !it.has_semi()) { | 74 | if let Some(m) = child.ancestors().filter_map(ast::Module::cast).find(|it| !it.has_semi()) { |
75 | module_from_inline(db, file_id.into(), m) | 75 | module_from_inline(db, file_id, m) |
76 | } else { | 76 | } else { |
77 | module_from_file_id(db, file_id.into()) | 77 | module_from_file_id(db, file_id) |
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
@@ -99,14 +99,12 @@ pub fn struct_from_module( | |||
99 | struct_def: &ast::StructDef, | 99 | struct_def: &ast::StructDef, |
100 | ) -> Struct { | 100 | ) -> Struct { |
101 | let (file_id, _) = module.definition_source(db); | 101 | let (file_id, _) = module.definition_source(db); |
102 | let file_id = file_id.into(); | ||
103 | let ctx = LocationCtx::new(db, module, file_id); | 102 | let ctx = LocationCtx::new(db, module, file_id); |
104 | Struct { id: ctx.to_def(struct_def) } | 103 | Struct { id: ctx.to_def(struct_def) } |
105 | } | 104 | } |
106 | 105 | ||
107 | pub fn enum_from_module(db: &impl HirDatabase, module: Module, enum_def: &ast::EnumDef) -> Enum { | 106 | pub fn enum_from_module(db: &impl HirDatabase, module: Module, enum_def: &ast::EnumDef) -> Enum { |
108 | let (file_id, _) = module.definition_source(db); | 107 | let (file_id, _) = module.definition_source(db); |
109 | let file_id = file_id.into(); | ||
110 | let ctx = LocationCtx::new(db, module, file_id); | 108 | let ctx = LocationCtx::new(db, module, file_id); |
111 | Enum { id: ctx.to_def(enum_def) } | 109 | Enum { id: ctx.to_def(enum_def) } |
112 | } | 110 | } |
@@ -117,7 +115,6 @@ pub fn trait_from_module( | |||
117 | trait_def: &ast::TraitDef, | 115 | trait_def: &ast::TraitDef, |
118 | ) -> Trait { | 116 | ) -> Trait { |
119 | let (file_id, _) = module.definition_source(db); | 117 | let (file_id, _) = module.definition_source(db); |
120 | let file_id = file_id.into(); | ||
121 | let ctx = LocationCtx::new(db, module, file_id); | 118 | let ctx = LocationCtx::new(db, module, file_id); |
122 | Trait { id: ctx.to_def(trait_def) } | 119 | Trait { id: ctx.to_def(trait_def) } |
123 | } | 120 | } |
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index 58cfcd8a2..5edc59f18 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs | |||
@@ -539,7 +539,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
539 | } | 539 | } |
540 | })?; | 540 | })?; |
541 | 541 | ||
542 | resolved = Resolution::Def(item.into()); | 542 | resolved = Resolution::Def(item); |
543 | } | 543 | } |
544 | 544 | ||
545 | match resolved { | 545 | match resolved { |
@@ -762,7 +762,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
762 | _ => &Ty::Unknown, | 762 | _ => &Ty::Unknown, |
763 | }; | 763 | }; |
764 | let subty = self.infer_pat(*pat, expectation, default_bm); | 764 | let subty = self.infer_pat(*pat, expectation, default_bm); |
765 | Ty::apply_one(TypeCtor::Ref(*mutability), subty.into()) | 765 | Ty::apply_one(TypeCtor::Ref(*mutability), subty) |
766 | } | 766 | } |
767 | Pat::TupleStruct { path: ref p, args: ref subpats } => { | 767 | Pat::TupleStruct { path: ref p, args: ref subpats } => { |
768 | self.infer_tuple_struct_pat(p.as_ref(), subpats, expected, default_bm) | 768 | self.infer_tuple_struct_pat(p.as_ref(), subpats, expected, default_bm) |
@@ -790,7 +790,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
790 | 790 | ||
791 | let bound_ty = match mode { | 791 | let bound_ty = match mode { |
792 | BindingMode::Ref(mutability) => { | 792 | BindingMode::Ref(mutability) => { |
793 | Ty::apply_one(TypeCtor::Ref(mutability), inner_ty.clone().into()) | 793 | Ty::apply_one(TypeCtor::Ref(mutability), inner_ty.clone()) |
794 | } | 794 | } |
795 | BindingMode::Move => inner_ty.clone(), | 795 | BindingMode::Move => inner_ty.clone(), |
796 | }; | 796 | }; |