aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Du <[email protected]>2019-06-03 15:21:08 +0100
committerAlan Du <[email protected]>2019-06-04 23:05:07 +0100
commit40424d4222d4630bc53294d10f1718f2d3d300de (patch)
tree4e27c7f2ce4a886e9a512b4986509b0927ae9ea1
parented3d93b875f25da6f81b8a107a8c200311240627 (diff)
Fix clippy::identity_conversion
-rw-r--r--crates/ra_batch/src/lib.rs4
-rw-r--r--crates/ra_hir/src/adt.rs2
-rw-r--r--crates/ra_hir/src/impl_block.rs1
-rw-r--r--crates/ra_hir/src/nameres.rs2
-rw-r--r--crates/ra_hir/src/nameres/collector.rs2
-rw-r--r--crates/ra_hir/src/nameres/raw.rs2
-rw-r--r--crates/ra_hir/src/source_binder.rs11
-rw-r--r--crates/ra_hir/src/ty/infer.rs6
-rw-r--r--crates/ra_ide_api/src/call_info.rs3
-rw-r--r--crates/ra_ide_api/src/typing.rs2
-rw-r--r--crates/ra_lsp_server/src/cargo_target_spec.rs2
-rw-r--r--crates/ra_lsp_server/src/main_loop.rs4
-rw-r--r--crates/ra_lsp_server/src/world.rs29
-rw-r--r--crates/ra_mbe/src/mbe_expander.rs24
-rw-r--r--crates/ra_mbe/src/syntax_bridge.rs7
-rw-r--r--crates/ra_project_model/src/cargo_workspace.rs7
16 files changed, 49 insertions, 59 deletions
diff --git a/crates/ra_batch/src/lib.rs b/crates/ra_batch/src/lib.rs
index a4a8462de..a445dcb4d 100644
--- a/crates/ra_batch/src/lib.rs
+++ b/crates/ra_batch/src/lib.rs
@@ -34,10 +34,10 @@ impl salsa::Database for BatchDatabase {
34} 34}
35 35
36fn vfs_file_to_id(f: ra_vfs::VfsFile) -> FileId { 36fn vfs_file_to_id(f: ra_vfs::VfsFile) -> FileId {
37 FileId(f.0.into()) 37 FileId(f.0)
38} 38}
39fn vfs_root_to_id(r: ra_vfs::VfsRoot) -> SourceRootId { 39fn vfs_root_to_id(r: ra_vfs::VfsRoot) -> SourceRootId {
40 SourceRootId(r.0.into()) 40 SourceRootId(r.0)
41} 41}
42 42
43impl BatchDatabase { 43impl BatchDatabase {
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
37impl Struct { 37impl 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(
48pub fn module_from_position(db: &impl HirDatabase, position: FilePosition) -> Option<Module> { 48pub 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
107pub fn enum_from_module(db: &impl HirDatabase, module: Module, enum_def: &ast::EnumDef) -> Enum { 106pub 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 };
diff --git a/crates/ra_ide_api/src/call_info.rs b/crates/ra_ide_api/src/call_info.rs
index 0d1f92ca6..bd08e183d 100644
--- a/crates/ra_ide_api/src/call_info.rs
+++ b/crates/ra_ide_api/src/call_info.rs
@@ -21,8 +21,7 @@ pub(crate) fn call_info(db: &RootDatabase, position: FilePosition) -> Option<Cal
21 let function = match calling_node { 21 let function = match calling_node {
22 FnCallNode::CallExpr(expr) => { 22 FnCallNode::CallExpr(expr) => {
23 //FIXME: apply subst 23 //FIXME: apply subst
24 let (callable_def, _subst) = 24 let (callable_def, _subst) = analyzer.type_of(db, expr.expr()?)?.as_callable()?;
25 analyzer.type_of(db, expr.expr()?.into())?.as_callable()?;
26 match callable_def { 25 match callable_def {
27 hir::CallableDef::Function(it) => it, 26 hir::CallableDef::Function(it) => it,
28 //FIXME: handle other callables 27 //FIXME: handle other callables
diff --git a/crates/ra_ide_api/src/typing.rs b/crates/ra_ide_api/src/typing.rs
index 63bc0cf88..3e35d8352 100644
--- a/crates/ra_ide_api/src/typing.rs
+++ b/crates/ra_ide_api/src/typing.rs
@@ -110,7 +110,7 @@ pub(crate) fn on_dot_typed(db: &RootDatabase, position: FilePosition) -> Option<
110 let mut edit = TextEditBuilder::default(); 110 let mut edit = TextEditBuilder::default();
111 edit.replace( 111 edit.replace(
112 TextRange::from_to(position.offset - current_indent_len, position.offset), 112 TextRange::from_to(position.offset - current_indent_len, position.offset),
113 target_indent.into(), 113 target_indent,
114 ); 114 );
115 115
116 let res = SourceChange::source_file_edit_from("reindent dot", position.file_id, edit.finish()) 116 let res = SourceChange::source_file_edit_from("reindent dot", position.file_id, edit.finish())
diff --git a/crates/ra_lsp_server/src/cargo_target_spec.rs b/crates/ra_lsp_server/src/cargo_target_spec.rs
index 742361155..082ac8609 100644
--- a/crates/ra_lsp_server/src/cargo_target_spec.rs
+++ b/crates/ra_lsp_server/src/cargo_target_spec.rs
@@ -64,7 +64,7 @@ impl CargoTargetSpec {
64 None => return Ok(None), 64 None => return Ok(None),
65 }; 65 };
66 let file_id = world.analysis().crate_root(crate_id)?; 66 let file_id = world.analysis().crate_root(crate_id)?;
67 let path = world.vfs.read().file2path(ra_vfs::VfsFile(file_id.0.into())); 67 let path = world.vfs.read().file2path(ra_vfs::VfsFile(file_id.0));
68 let res = world.workspaces.iter().find_map(|ws| match ws { 68 let res = world.workspaces.iter().find_map(|ws| match ws {
69 project_model::ProjectWorkspace::Cargo { cargo, .. } => { 69 project_model::ProjectWorkspace::Cargo { cargo, .. } => {
70 let tgt = cargo.target_by_root(&path)?; 70 let tgt = cargo.target_by_root(&path)?;
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs
index 6080a3a4e..090fb9b1b 100644
--- a/crates/ra_lsp_server/src/main_loop.rs
+++ b/crates/ra_lsp_server/src/main_loop.rs
@@ -384,7 +384,7 @@ fn on_notification(
384 if let Some(file_id) = 384 if let Some(file_id) =
385 state.vfs.write().add_file_overlay(&path, params.text_document.text) 385 state.vfs.write().add_file_overlay(&path, params.text_document.text)
386 { 386 {
387 subs.add_sub(FileId(file_id.0.into())); 387 subs.add_sub(FileId(file_id.0));
388 } 388 }
389 return Ok(()); 389 return Ok(());
390 } 390 }
@@ -406,7 +406,7 @@ fn on_notification(
406 let uri = params.text_document.uri; 406 let uri = params.text_document.uri;
407 let path = uri.to_file_path().map_err(|()| format_err!("invalid uri: {}", uri))?; 407 let path = uri.to_file_path().map_err(|()| format_err!("invalid uri: {}", uri))?;
408 if let Some(file_id) = state.vfs.write().remove_file_overlay(path.as_path()) { 408 if let Some(file_id) = state.vfs.write().remove_file_overlay(path.as_path()) {
409 subs.remove_sub(FileId(file_id.0.into())); 409 subs.remove_sub(FileId(file_id.0));
410 } 410 }
411 let params = req::PublishDiagnosticsParams { uri, diagnostics: Vec::new() }; 411 let params = req::PublishDiagnosticsParams { uri, diagnostics: Vec::new() };
412 let not = RawNotification::new::<req::PublishDiagnostics>(&params); 412 let not = RawNotification::new::<req::PublishDiagnostics>(&params);
diff --git a/crates/ra_lsp_server/src/world.rs b/crates/ra_lsp_server/src/world.rs
index e0d2f6306..cd8df4fdb 100644
--- a/crates/ra_lsp_server/src/world.rs
+++ b/crates/ra_lsp_server/src/world.rs
@@ -60,14 +60,14 @@ impl WorldState {
60 for r in vfs_roots { 60 for r in vfs_roots {
61 let vfs_root_path = vfs.root2path(r); 61 let vfs_root_path = vfs.root2path(r);
62 let is_local = folder_roots.iter().any(|it| vfs_root_path.starts_with(it)); 62 let is_local = folder_roots.iter().any(|it| vfs_root_path.starts_with(it));
63 change.add_root(SourceRootId(r.0.into()), is_local); 63 change.add_root(SourceRootId(r.0), is_local);
64 } 64 }
65 65
66 // Create crate graph from all the workspaces 66 // Create crate graph from all the workspaces
67 let mut crate_graph = CrateGraph::default(); 67 let mut crate_graph = CrateGraph::default();
68 let mut load = |path: &std::path::Path| { 68 let mut load = |path: &std::path::Path| {
69 let vfs_file = vfs.load(path); 69 let vfs_file = vfs.load(path);
70 vfs_file.map(|f| FileId(f.0.into())) 70 vfs_file.map(|f| FileId(f.0))
71 }; 71 };
72 for ws in workspaces.iter() { 72 for ws in workspaces.iter() {
73 crate_graph.extend(ws.to_crate_graph(&mut load)); 73 crate_graph.extend(ws.to_crate_graph(&mut load));
@@ -105,29 +105,24 @@ impl WorldState {
105 if is_local { 105 if is_local {
106 self.roots_to_scan -= 1; 106 self.roots_to_scan -= 1;
107 for (file, path, text) in files { 107 for (file, path, text) in files {
108 change.add_file( 108 change.add_file(SourceRootId(root.0), FileId(file.0), path, text);
109 SourceRootId(root.0.into()),
110 FileId(file.0.into()),
111 path,
112 text,
113 );
114 } 109 }
115 } else { 110 } else {
116 let files = files 111 let files = files
117 .into_iter() 112 .into_iter()
118 .map(|(vfsfile, path, text)| (FileId(vfsfile.0.into()), path, text)) 113 .map(|(vfsfile, path, text)| (FileId(vfsfile.0), path, text))
119 .collect(); 114 .collect();
120 libs.push((SourceRootId(root.0.into()), files)); 115 libs.push((SourceRootId(root.0), files));
121 } 116 }
122 } 117 }
123 VfsChange::AddFile { root, file, path, text } => { 118 VfsChange::AddFile { root, file, path, text } => {
124 change.add_file(SourceRootId(root.0.into()), FileId(file.0.into()), path, text); 119 change.add_file(SourceRootId(root.0), FileId(file.0), path, text);
125 } 120 }
126 VfsChange::RemoveFile { root, file, path } => { 121 VfsChange::RemoveFile { root, file, path } => {
127 change.remove_file(SourceRootId(root.0.into()), FileId(file.0.into()), path) 122 change.remove_file(SourceRootId(root.0), FileId(file.0), path)
128 } 123 }
129 VfsChange::ChangeFile { file, text } => { 124 VfsChange::ChangeFile { file, text } => {
130 change.change_file(FileId(file.0.into()), text); 125 change.change_file(FileId(file.0), text);
131 } 126 }
132 } 127 }
133 } 128 }
@@ -178,18 +173,18 @@ impl WorldSnapshot {
178 message: "Rust file outside current workspace is not supported yet.".to_string(), 173 message: "Rust file outside current workspace is not supported yet.".to_string(),
179 }) 174 })
180 })?; 175 })?;
181 Ok(FileId(file.0.into())) 176 Ok(FileId(file.0))
182 } 177 }
183 178
184 pub fn file_id_to_uri(&self, id: FileId) -> Result<Url> { 179 pub fn file_id_to_uri(&self, id: FileId) -> Result<Url> {
185 let path = self.vfs.read().file2path(VfsFile(id.0.into())); 180 let path = self.vfs.read().file2path(VfsFile(id.0));
186 let url = Url::from_file_path(&path) 181 let url = Url::from_file_path(&path)
187 .map_err(|_| format_err!("can't convert path to url: {}", path.display()))?; 182 .map_err(|_| format_err!("can't convert path to url: {}", path.display()))?;
188 Ok(url) 183 Ok(url)
189 } 184 }
190 185
191 pub fn path_to_uri(&self, root: SourceRootId, path: &RelativePathBuf) -> Result<Url> { 186 pub fn path_to_uri(&self, root: SourceRootId, path: &RelativePathBuf) -> Result<Url> {
192 let base = self.vfs.read().root2path(VfsRoot(root.0.into())); 187 let base = self.vfs.read().root2path(VfsRoot(root.0));
193 let path = path.to_path(base); 188 let path = path.to_path(base);
194 let url = Url::from_file_path(&path) 189 let url = Url::from_file_path(&path)
195 .map_err(|_| format_err!("can't convert path to url: {}", path.display()))?; 190 .map_err(|_| format_err!("can't convert path to url: {}", path.display()))?;
@@ -212,7 +207,7 @@ impl WorldSnapshot {
212 } 207 }
213 208
214 pub fn workspace_root_for(&self, file_id: FileId) -> Option<&Path> { 209 pub fn workspace_root_for(&self, file_id: FileId) -> Option<&Path> {
215 let path = self.vfs.read().file2path(VfsFile(file_id.0.into())); 210 let path = self.vfs.read().file2path(VfsFile(file_id.0));
216 self.workspaces.iter().find_map(|ws| ws.workspace_root_for(&path)) 211 self.workspaces.iter().find_map(|ws| ws.workspace_root_for(&path))
217 } 212 }
218} 213}
diff --git a/crates/ra_mbe/src/mbe_expander.rs b/crates/ra_mbe/src/mbe_expander.rs
index a0bd0c5f8..7cfb47f7a 100644
--- a/crates/ra_mbe/src/mbe_expander.rs
+++ b/crates/ra_mbe/src/mbe_expander.rs
@@ -206,48 +206,48 @@ fn match_lhs(pattern: &crate::Subtree, input: &mut TtCursor) -> Result<Bindings,
206 "path" => { 206 "path" => {
207 let path = 207 let path =
208 input.eat_path().ok_or(ExpandError::UnexpectedToken)?.clone(); 208 input.eat_path().ok_or(ExpandError::UnexpectedToken)?.clone();
209 res.inner.insert(text.clone(), Binding::Simple(path.into())); 209 res.inner.insert(text.clone(), Binding::Simple(path));
210 } 210 }
211 "expr" => { 211 "expr" => {
212 let expr = 212 let expr =
213 input.eat_expr().ok_or(ExpandError::UnexpectedToken)?.clone(); 213 input.eat_expr().ok_or(ExpandError::UnexpectedToken)?.clone();
214 res.inner.insert(text.clone(), Binding::Simple(expr.into())); 214 res.inner.insert(text.clone(), Binding::Simple(expr));
215 } 215 }
216 "ty" => { 216 "ty" => {
217 let ty = input.eat_ty().ok_or(ExpandError::UnexpectedToken)?.clone(); 217 let ty = input.eat_ty().ok_or(ExpandError::UnexpectedToken)?.clone();
218 res.inner.insert(text.clone(), Binding::Simple(ty.into())); 218 res.inner.insert(text.clone(), Binding::Simple(ty));
219 } 219 }
220 "pat" => { 220 "pat" => {
221 let pat = input.eat_pat().ok_or(ExpandError::UnexpectedToken)?.clone(); 221 let pat = input.eat_pat().ok_or(ExpandError::UnexpectedToken)?.clone();
222 res.inner.insert(text.clone(), Binding::Simple(pat.into())); 222 res.inner.insert(text.clone(), Binding::Simple(pat));
223 } 223 }
224 "stmt" => { 224 "stmt" => {
225 let pat = input.eat_stmt().ok_or(ExpandError::UnexpectedToken)?.clone(); 225 let pat = input.eat_stmt().ok_or(ExpandError::UnexpectedToken)?.clone();
226 res.inner.insert(text.clone(), Binding::Simple(pat.into())); 226 res.inner.insert(text.clone(), Binding::Simple(pat));
227 } 227 }
228 "block" => { 228 "block" => {
229 let block = 229 let block =
230 input.eat_block().ok_or(ExpandError::UnexpectedToken)?.clone(); 230 input.eat_block().ok_or(ExpandError::UnexpectedToken)?.clone();
231 res.inner.insert(text.clone(), Binding::Simple(block.into())); 231 res.inner.insert(text.clone(), Binding::Simple(block));
232 } 232 }
233 "meta" => { 233 "meta" => {
234 let meta = 234 let meta =
235 input.eat_meta().ok_or(ExpandError::UnexpectedToken)?.clone(); 235 input.eat_meta().ok_or(ExpandError::UnexpectedToken)?.clone();
236 res.inner.insert(text.clone(), Binding::Simple(meta.into())); 236 res.inner.insert(text.clone(), Binding::Simple(meta));
237 } 237 }
238 "tt" => { 238 "tt" => {
239 let token = input.eat().ok_or(ExpandError::UnexpectedToken)?.clone(); 239 let token = input.eat().ok_or(ExpandError::UnexpectedToken)?.clone();
240 res.inner.insert(text.clone(), Binding::Simple(token.into())); 240 res.inner.insert(text.clone(), Binding::Simple(token));
241 } 241 }
242 "item" => { 242 "item" => {
243 let item = 243 let item =
244 input.eat_item().ok_or(ExpandError::UnexpectedToken)?.clone(); 244 input.eat_item().ok_or(ExpandError::UnexpectedToken)?.clone();
245 res.inner.insert(text.clone(), Binding::Simple(item.into())); 245 res.inner.insert(text.clone(), Binding::Simple(item));
246 } 246 }
247 "lifetime" => { 247 "lifetime" => {
248 let lifetime = 248 let lifetime =
249 input.eat_lifetime().ok_or(ExpandError::UnexpectedToken)?.clone(); 249 input.eat_lifetime().ok_or(ExpandError::UnexpectedToken)?.clone();
250 res.inner.insert(text.clone(), Binding::Simple(lifetime.into())); 250 res.inner.insert(text.clone(), Binding::Simple(lifetime));
251 } 251 }
252 "literal" => { 252 "literal" => {
253 let literal = 253 let literal =
@@ -262,7 +262,7 @@ fn match_lhs(pattern: &crate::Subtree, input: &mut TtCursor) -> Result<Bindings,
262 // `vis` is optional 262 // `vis` is optional
263 if let Some(vis) = input.try_eat_vis() { 263 if let Some(vis) = input.try_eat_vis() {
264 let vis = vis.clone(); 264 let vis = vis.clone();
265 res.inner.insert(text.clone(), Binding::Simple(vis.into())); 265 res.inner.insert(text.clone(), Binding::Simple(vis));
266 } else { 266 } else {
267 res.push_optional(&text); 267 res.push_optional(&text);
268 } 268 }
@@ -452,7 +452,7 @@ fn expand_tt(
452 452
453 let idx = ctx.nesting.pop().unwrap(); 453 let idx = ctx.nesting.pop().unwrap();
454 ctx.nesting.push(idx + 1); 454 ctx.nesting.push(idx + 1);
455 token_trees.push(reduce_single_token(t).into()); 455 token_trees.push(reduce_single_token(t));
456 456
457 if let Some(ref sep) = repeat.separator { 457 if let Some(ref sep) = repeat.separator {
458 match sep { 458 match sep {
diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs
index e3f93b23c..9d3d2ad5b 100644
--- a/crates/ra_mbe/src/syntax_bridge.rs
+++ b/crates/ra_mbe/src/syntax_bridge.rs
@@ -155,9 +155,10 @@ fn convert_doc_comment<'a>(token: &ra_syntax::SyntaxToken<'a>) -> Option<Vec<tt:
155 if let ast::CommentPlacement::Inner = doc { 155 if let ast::CommentPlacement::Inner = doc {
156 token_trees.push(mk_punct('!')); 156 token_trees.push(mk_punct('!'));
157 } 157 }
158 token_trees.push(tt::TokenTree::from(tt::Subtree::from( 158 token_trees.push(tt::TokenTree::from(tt::Subtree {
159 tt::Subtree { delimiter: tt::Delimiter::Bracket, token_trees: meta_tkns }.into(), 159 delimiter: tt::Delimiter::Bracket,
160 ))); 160 token_trees: meta_tkns,
161 }));
161 162
162 return Some(token_trees); 163 return Some(token_trees);
163 164
diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs
index 71976071f..5a1657788 100644
--- a/crates/ra_project_model/src/cargo_workspace.rs
+++ b/crates/ra_project_model/src/cargo_workspace.rs
@@ -137,7 +137,7 @@ impl CargoWorkspace {
137 for meta_pkg in meta.packages { 137 for meta_pkg in meta.packages {
138 let is_member = ws_members.contains(&meta_pkg.id); 138 let is_member = ws_members.contains(&meta_pkg.id);
139 let pkg = packages.alloc(PackageData { 139 let pkg = packages.alloc(PackageData {
140 name: meta_pkg.name.into(), 140 name: meta_pkg.name,
141 manifest: meta_pkg.manifest_path.clone(), 141 manifest: meta_pkg.manifest_path.clone(),
142 targets: Vec::new(), 142 targets: Vec::new(),
143 is_member, 143 is_member,
@@ -149,7 +149,7 @@ impl CargoWorkspace {
149 for meta_tgt in meta_pkg.targets { 149 for meta_tgt in meta_pkg.targets {
150 let tgt = targets.alloc(TargetData { 150 let tgt = targets.alloc(TargetData {
151 pkg, 151 pkg,
152 name: meta_tgt.name.into(), 152 name: meta_tgt.name,
153 root: meta_tgt.src_path.clone(), 153 root: meta_tgt.src_path.clone(),
154 kind: TargetKind::new(meta_tgt.kind.as_slice()), 154 kind: TargetKind::new(meta_tgt.kind.as_slice()),
155 }); 155 });
@@ -160,8 +160,7 @@ impl CargoWorkspace {
160 for node in resolve.nodes { 160 for node in resolve.nodes {
161 let source = pkg_by_id[&node.id]; 161 let source = pkg_by_id[&node.id];
162 for dep_node in node.deps { 162 for dep_node in node.deps {
163 let dep = 163 let dep = PackageDependency { name: dep_node.name, pkg: pkg_by_id[&dep_node.pkg] };
164 PackageDependency { name: dep_node.name.into(), pkg: pkg_by_id[&dep_node.pkg] };
165 packages[source].dependencies.push(dep); 164 packages[source].dependencies.push(dep);
166 } 165 }
167 } 166 }