aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorMatthias Krüger <[email protected]>2021-03-17 00:27:56 +0000
committerMatthias Krüger <[email protected]>2021-03-17 00:27:56 +0000
commit966c23f5290275ce17564f6027a17ec20cd6078f (patch)
tree9e977a29eaf10d1733340563ef31fda064e37400 /crates
parent83e6940efb42675226adb8d2856c095b8dce36c5 (diff)
avoid converting types into themselves via .into() (clippy::useless-conversion)
example: let x: String = String::from("hello world").into();
Diffstat (limited to 'crates')
-rw-r--r--crates/base_db/src/fixture.rs2
-rw-r--r--crates/hir/src/attrs.rs2
-rw-r--r--crates/hir/src/lib.rs12
-rw-r--r--crates/hir/src/semantics.rs2
-rw-r--r--crates/hir/src/source_analyzer.rs2
-rw-r--r--crates/hir_def/src/attr.rs2
-rw-r--r--crates/hir_ty/src/diagnostics/decl_check.rs18
-rw-r--r--crates/hir_ty/src/diagnostics/expr.rs18
-rw-r--r--crates/hir_ty/src/diagnostics/unsafe_check.rs2
-rw-r--r--crates/hir_ty/src/traits/chalk/mapping.rs2
-rw-r--r--crates/ide/src/diagnostics/fixes.rs2
-rw-r--r--crates/ide_completion/src/completions.rs2
-rw-r--r--crates/ide_completion/src/completions/postfix/format_like.rs2
-rw-r--r--crates/ide_db/src/defs.rs2
-rw-r--r--crates/ide_db/src/helpers/insert_use.rs2
-rw-r--r--crates/mbe/src/benchmark.rs18
-rw-r--r--crates/mbe/src/expander/matcher.rs2
-rw-r--r--crates/mbe/src/syntax_bridge.rs4
-rw-r--r--crates/mbe/src/tests.rs2
-rw-r--r--crates/proc_macro_api/src/rpc.rs11
-rw-r--r--crates/rust-analyzer/src/lsp_utils.rs2
-rw-r--r--crates/rust-analyzer/src/to_proto.rs2
-rw-r--r--crates/syntax/src/ast/edit.rs2
-rw-r--r--crates/syntax/src/ted.rs2
24 files changed, 56 insertions, 61 deletions
diff --git a/crates/base_db/src/fixture.rs b/crates/base_db/src/fixture.rs
index cad6866aa..8d4641355 100644
--- a/crates/base_db/src/fixture.rs
+++ b/crates/base_db/src/fixture.rs
@@ -197,7 +197,7 @@ impl ChangeFixture {
197 197
198 change.change_file(file_id, Some(Arc::new(text))); 198 change.change_file(file_id, Some(Arc::new(text)));
199 let path = VfsPath::new_virtual_path(meta.path); 199 let path = VfsPath::new_virtual_path(meta.path);
200 file_set.insert(file_id, path.into()); 200 file_set.insert(file_id, path);
201 files.push(file_id); 201 files.push(file_id);
202 file_id.0 += 1; 202 file_id.0 += 1;
203 } 203 }
diff --git a/crates/hir/src/attrs.rs b/crates/hir/src/attrs.rs
index 9e6a3e155..b9c695921 100644
--- a/crates/hir/src/attrs.rs
+++ b/crates/hir/src/attrs.rs
@@ -124,5 +124,5 @@ fn resolve_doc_path(
124 Some(Namespace::Macros) => return None, 124 Some(Namespace::Macros) => return None,
125 None => resolved.iter_items().find_map(|it| it.as_module_def_id())?, 125 None => resolved.iter_items().find_map(|it| it.as_module_def_id())?,
126 }; 126 };
127 Some(def.into()) 127 Some(def)
128} 128}
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index 12dd5fb38..861b7329e 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -1335,7 +1335,7 @@ impl Local {
1335 1335
1336 // FIXME: why is this an option? It shouldn't be? 1336 // FIXME: why is this an option? It shouldn't be?
1337 pub fn name(self, db: &dyn HirDatabase) -> Option<Name> { 1337 pub fn name(self, db: &dyn HirDatabase) -> Option<Name> {
1338 let body = db.body(self.parent.into()); 1338 let body = db.body(self.parent);
1339 match &body[self.pat_id] { 1339 match &body[self.pat_id] {
1340 Pat::Bind { name, .. } => Some(name.clone()), 1340 Pat::Bind { name, .. } => Some(name.clone()),
1341 _ => None, 1341 _ => None,
@@ -1347,7 +1347,7 @@ impl Local {
1347 } 1347 }
1348 1348
1349 pub fn is_mut(self, db: &dyn HirDatabase) -> bool { 1349 pub fn is_mut(self, db: &dyn HirDatabase) -> bool {
1350 let body = db.body(self.parent.into()); 1350 let body = db.body(self.parent);
1351 matches!(&body[self.pat_id], Pat::Bind { mode: BindingAnnotation::Mutable, .. }) 1351 matches!(&body[self.pat_id], Pat::Bind { mode: BindingAnnotation::Mutable, .. })
1352 } 1352 }
1353 1353
@@ -1360,7 +1360,7 @@ impl Local {
1360 } 1360 }
1361 1361
1362 pub fn ty(self, db: &dyn HirDatabase) -> Type { 1362 pub fn ty(self, db: &dyn HirDatabase) -> Type {
1363 let def = DefWithBodyId::from(self.parent); 1363 let def = self.parent;
1364 let infer = db.infer(def); 1364 let infer = db.infer(def);
1365 let ty = infer[self.pat_id].clone(); 1365 let ty = infer[self.pat_id].clone();
1366 let krate = def.module(db.upcast()).krate(); 1366 let krate = def.module(db.upcast()).krate();
@@ -1368,7 +1368,7 @@ impl Local {
1368 } 1368 }
1369 1369
1370 pub fn source(self, db: &dyn HirDatabase) -> InFile<Either<ast::IdentPat, ast::SelfParam>> { 1370 pub fn source(self, db: &dyn HirDatabase) -> InFile<Either<ast::IdentPat, ast::SelfParam>> {
1371 let (_body, source_map) = db.body_with_source_map(self.parent.into()); 1371 let (_body, source_map) = db.body_with_source_map(self.parent);
1372 let src = source_map.pat_syntax(self.pat_id).unwrap(); // Hmm... 1372 let src = source_map.pat_syntax(self.pat_id).unwrap(); // Hmm...
1373 let root = src.file_syntax(db.upcast()); 1373 let root = src.file_syntax(db.upcast());
1374 src.map(|ast| { 1374 src.map(|ast| {
@@ -1393,12 +1393,12 @@ impl Label {
1393 } 1393 }
1394 1394
1395 pub fn name(self, db: &dyn HirDatabase) -> Name { 1395 pub fn name(self, db: &dyn HirDatabase) -> Name {
1396 let body = db.body(self.parent.into()); 1396 let body = db.body(self.parent);
1397 body[self.label_id].name.clone() 1397 body[self.label_id].name.clone()
1398 } 1398 }
1399 1399
1400 pub fn source(self, db: &dyn HirDatabase) -> InFile<ast::Label> { 1400 pub fn source(self, db: &dyn HirDatabase) -> InFile<ast::Label> {
1401 let (_body, source_map) = db.body_with_source_map(self.parent.into()); 1401 let (_body, source_map) = db.body_with_source_map(self.parent);
1402 let src = source_map.label_syntax(self.label_id); 1402 let src = source_map.label_syntax(self.label_id);
1403 let root = src.file_syntax(db.upcast()); 1403 let root = src.file_syntax(db.upcast());
1404 src.map(|ast| ast.to_node(&root)) 1404 src.map(|ast| ast.to_node(&root))
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs
index 03c9371b5..00b076175 100644
--- a/crates/hir/src/semantics.rs
+++ b/crates/hir/src/semantics.rs
@@ -835,7 +835,7 @@ impl<'a> SemanticsScope<'a> {
835 resolver::ScopeDef::AdtSelfType(it) => ScopeDef::AdtSelfType(it.into()), 835 resolver::ScopeDef::AdtSelfType(it) => ScopeDef::AdtSelfType(it.into()),
836 resolver::ScopeDef::GenericParam(id) => ScopeDef::GenericParam(id.into()), 836 resolver::ScopeDef::GenericParam(id) => ScopeDef::GenericParam(id.into()),
837 resolver::ScopeDef::Local(pat_id) => { 837 resolver::ScopeDef::Local(pat_id) => {
838 let parent = resolver.body_owner().unwrap().into(); 838 let parent = resolver.body_owner().unwrap();
839 ScopeDef::Local(Local { parent, pat_id }) 839 ScopeDef::Local(Local { parent, pat_id })
840 } 840 }
841 }; 841 };
diff --git a/crates/hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs
index 117f32a9e..37d162b32 100644
--- a/crates/hir/src/source_analyzer.rs
+++ b/crates/hir/src/source_analyzer.rs
@@ -484,7 +484,7 @@ fn resolve_hir_path_(
484 resolver.resolve_path_in_value_ns_fully(db.upcast(), path.mod_path()).and_then(|val| { 484 resolver.resolve_path_in_value_ns_fully(db.upcast(), path.mod_path()).and_then(|val| {
485 let res = match val { 485 let res = match val {
486 ValueNs::LocalBinding(pat_id) => { 486 ValueNs::LocalBinding(pat_id) => {
487 let var = Local { parent: body_owner?.into(), pat_id }; 487 let var = Local { parent: body_owner?, pat_id };
488 PathResolution::Local(var) 488 PathResolution::Local(var)
489 } 489 }
490 ValueNs::FunctionId(it) => PathResolution::Def(Function::from(it).into()), 490 ValueNs::FunctionId(it) => PathResolution::Def(Function::from(it).into()),
diff --git a/crates/hir_def/src/attr.rs b/crates/hir_def/src/attr.rs
index 7b41b148c..b0b4b5052 100644
--- a/crates/hir_def/src/attr.rs
+++ b/crates/hir_def/src/attr.rs
@@ -325,7 +325,7 @@ impl Attrs {
325 if docs.is_empty() { 325 if docs.is_empty() {
326 None 326 None
327 } else { 327 } else {
328 Some(Documentation(docs.into())) 328 Some(Documentation(docs))
329 } 329 }
330 } 330 }
331} 331}
diff --git a/crates/hir_ty/src/diagnostics/decl_check.rs b/crates/hir_ty/src/diagnostics/decl_check.rs
index 982ad5b9e..bfe239793 100644
--- a/crates/hir_ty/src/diagnostics/decl_check.rs
+++ b/crates/hir_ty/src/diagnostics/decl_check.rs
@@ -203,7 +203,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> {
203 let diagnostic = IncorrectCase { 203 let diagnostic = IncorrectCase {
204 file: fn_src.file_id, 204 file: fn_src.file_id,
205 ident_type: IdentType::Function, 205 ident_type: IdentType::Function,
206 ident: AstPtr::new(&ast_ptr).into(), 206 ident: AstPtr::new(&ast_ptr),
207 expected_case: replacement.expected_case, 207 expected_case: replacement.expected_case,
208 ident_text: replacement.current_name.to_string(), 208 ident_text: replacement.current_name.to_string(),
209 suggested_text: replacement.suggested_text, 209 suggested_text: replacement.suggested_text,
@@ -261,7 +261,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> {
261 let diagnostic = IncorrectCase { 261 let diagnostic = IncorrectCase {
262 file: fn_src.file_id, 262 file: fn_src.file_id,
263 ident_type: IdentType::Argument, 263 ident_type: IdentType::Argument,
264 ident: AstPtr::new(&ast_ptr).into(), 264 ident: AstPtr::new(&ast_ptr),
265 expected_case: param_to_rename.expected_case, 265 expected_case: param_to_rename.expected_case,
266 ident_text: param_to_rename.current_name.to_string(), 266 ident_text: param_to_rename.current_name.to_string(),
267 suggested_text: param_to_rename.suggested_text, 267 suggested_text: param_to_rename.suggested_text,
@@ -313,7 +313,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> {
313 let diagnostic = IncorrectCase { 313 let diagnostic = IncorrectCase {
314 file: source_ptr.file_id, 314 file: source_ptr.file_id,
315 ident_type: IdentType::Variable, 315 ident_type: IdentType::Variable,
316 ident: AstPtr::new(&name_ast).into(), 316 ident: AstPtr::new(&name_ast),
317 expected_case: replacement.expected_case, 317 expected_case: replacement.expected_case,
318 ident_text: replacement.current_name.to_string(), 318 ident_text: replacement.current_name.to_string(),
319 suggested_text: replacement.suggested_text, 319 suggested_text: replacement.suggested_text,
@@ -403,7 +403,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> {
403 let diagnostic = IncorrectCase { 403 let diagnostic = IncorrectCase {
404 file: struct_src.file_id, 404 file: struct_src.file_id,
405 ident_type: IdentType::Structure, 405 ident_type: IdentType::Structure,
406 ident: AstPtr::new(&ast_ptr).into(), 406 ident: AstPtr::new(&ast_ptr),
407 expected_case: replacement.expected_case, 407 expected_case: replacement.expected_case,
408 ident_text: replacement.current_name.to_string(), 408 ident_text: replacement.current_name.to_string(),
409 suggested_text: replacement.suggested_text, 409 suggested_text: replacement.suggested_text,
@@ -448,7 +448,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> {
448 let diagnostic = IncorrectCase { 448 let diagnostic = IncorrectCase {
449 file: struct_src.file_id, 449 file: struct_src.file_id,
450 ident_type: IdentType::Field, 450 ident_type: IdentType::Field,
451 ident: AstPtr::new(&ast_ptr).into(), 451 ident: AstPtr::new(&ast_ptr),
452 expected_case: field_to_rename.expected_case, 452 expected_case: field_to_rename.expected_case,
453 ident_text: field_to_rename.current_name.to_string(), 453 ident_text: field_to_rename.current_name.to_string(),
454 suggested_text: field_to_rename.suggested_text, 454 suggested_text: field_to_rename.suggested_text,
@@ -527,7 +527,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> {
527 let diagnostic = IncorrectCase { 527 let diagnostic = IncorrectCase {
528 file: enum_src.file_id, 528 file: enum_src.file_id,
529 ident_type: IdentType::Enum, 529 ident_type: IdentType::Enum,
530 ident: AstPtr::new(&ast_ptr).into(), 530 ident: AstPtr::new(&ast_ptr),
531 expected_case: replacement.expected_case, 531 expected_case: replacement.expected_case,
532 ident_text: replacement.current_name.to_string(), 532 ident_text: replacement.current_name.to_string(),
533 suggested_text: replacement.suggested_text, 533 suggested_text: replacement.suggested_text,
@@ -572,7 +572,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> {
572 let diagnostic = IncorrectCase { 572 let diagnostic = IncorrectCase {
573 file: enum_src.file_id, 573 file: enum_src.file_id,
574 ident_type: IdentType::Variant, 574 ident_type: IdentType::Variant,
575 ident: AstPtr::new(&ast_ptr).into(), 575 ident: AstPtr::new(&ast_ptr),
576 expected_case: variant_to_rename.expected_case, 576 expected_case: variant_to_rename.expected_case,
577 ident_text: variant_to_rename.current_name.to_string(), 577 ident_text: variant_to_rename.current_name.to_string(),
578 suggested_text: variant_to_rename.suggested_text, 578 suggested_text: variant_to_rename.suggested_text,
@@ -617,7 +617,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> {
617 let diagnostic = IncorrectCase { 617 let diagnostic = IncorrectCase {
618 file: const_src.file_id, 618 file: const_src.file_id,
619 ident_type: IdentType::Constant, 619 ident_type: IdentType::Constant,
620 ident: AstPtr::new(&ast_ptr).into(), 620 ident: AstPtr::new(&ast_ptr),
621 expected_case: replacement.expected_case, 621 expected_case: replacement.expected_case,
622 ident_text: replacement.current_name.to_string(), 622 ident_text: replacement.current_name.to_string(),
623 suggested_text: replacement.suggested_text, 623 suggested_text: replacement.suggested_text,
@@ -665,7 +665,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> {
665 let diagnostic = IncorrectCase { 665 let diagnostic = IncorrectCase {
666 file: static_src.file_id, 666 file: static_src.file_id,
667 ident_type: IdentType::StaticVariable, 667 ident_type: IdentType::StaticVariable,
668 ident: AstPtr::new(&ast_ptr).into(), 668 ident: AstPtr::new(&ast_ptr),
669 expected_case: replacement.expected_case, 669 expected_case: replacement.expected_case,
670 ident_text: replacement.current_name.to_string(), 670 ident_text: replacement.current_name.to_string(),
671 suggested_text: replacement.suggested_text, 671 suggested_text: replacement.suggested_text,
diff --git a/crates/hir_ty/src/diagnostics/expr.rs b/crates/hir_ty/src/diagnostics/expr.rs
index b2bfd68d4..71b2cade0 100644
--- a/crates/hir_ty/src/diagnostics/expr.rs
+++ b/crates/hir_ty/src/diagnostics/expr.rs
@@ -44,7 +44,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
44 pub(super) fn validate_body(&mut self, db: &dyn HirDatabase) { 44 pub(super) fn validate_body(&mut self, db: &dyn HirDatabase) {
45 self.check_for_filter_map_next(db); 45 self.check_for_filter_map_next(db);
46 46
47 let body = db.body(self.owner.into()); 47 let body = db.body(self.owner);
48 48
49 for (id, expr) in body.exprs.iter() { 49 for (id, expr) in body.exprs.iter() {
50 if let Some((variant_def, missed_fields, true)) = 50 if let Some((variant_def, missed_fields, true)) =
@@ -98,7 +98,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
98 missed_fields: Vec<LocalFieldId>, 98 missed_fields: Vec<LocalFieldId>,
99 ) { 99 ) {
100 // XXX: only look at source_map if we do have missing fields 100 // XXX: only look at source_map if we do have missing fields
101 let (_, source_map) = db.body_with_source_map(self.owner.into()); 101 let (_, source_map) = db.body_with_source_map(self.owner);
102 102
103 if let Ok(source_ptr) = source_map.expr_syntax(id) { 103 if let Ok(source_ptr) = source_map.expr_syntax(id) {
104 let root = source_ptr.file_syntax(db.upcast()); 104 let root = source_ptr.file_syntax(db.upcast());
@@ -128,7 +128,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
128 missed_fields: Vec<LocalFieldId>, 128 missed_fields: Vec<LocalFieldId>,
129 ) { 129 ) {
130 // XXX: only look at source_map if we do have missing fields 130 // XXX: only look at source_map if we do have missing fields
131 let (_, source_map) = db.body_with_source_map(self.owner.into()); 131 let (_, source_map) = db.body_with_source_map(self.owner);
132 132
133 if let Ok(source_ptr) = source_map.pat_syntax(id) { 133 if let Ok(source_ptr) = source_map.pat_syntax(id) {
134 if let Some(expr) = source_ptr.value.as_ref().left() { 134 if let Some(expr) = source_ptr.value.as_ref().left() {
@@ -175,7 +175,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
175 }; 175 };
176 176
177 // Search function body for instances of .filter_map(..).next() 177 // Search function body for instances of .filter_map(..).next()
178 let body = db.body(self.owner.into()); 178 let body = db.body(self.owner);
179 let mut prev = None; 179 let mut prev = None;
180 for (id, expr) in body.exprs.iter() { 180 for (id, expr) in body.exprs.iter() {
181 if let Expr::MethodCall { receiver, .. } = expr { 181 if let Expr::MethodCall { receiver, .. } = expr {
@@ -192,7 +192,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
192 if function_id == *next_function_id { 192 if function_id == *next_function_id {
193 if let Some(filter_map_id) = prev { 193 if let Some(filter_map_id) = prev {
194 if *receiver == filter_map_id { 194 if *receiver == filter_map_id {
195 let (_, source_map) = db.body_with_source_map(self.owner.into()); 195 let (_, source_map) = db.body_with_source_map(self.owner);
196 if let Ok(next_source_ptr) = source_map.expr_syntax(id) { 196 if let Ok(next_source_ptr) = source_map.expr_syntax(id) {
197 self.sink.push(ReplaceFilterMapNextWithFindMap { 197 self.sink.push(ReplaceFilterMapNextWithFindMap {
198 file: next_source_ptr.file_id, 198 file: next_source_ptr.file_id,
@@ -262,7 +262,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
262 let mut arg_count = args.len(); 262 let mut arg_count = args.len();
263 263
264 if arg_count != param_count { 264 if arg_count != param_count {
265 let (_, source_map) = db.body_with_source_map(self.owner.into()); 265 let (_, source_map) = db.body_with_source_map(self.owner);
266 if let Ok(source_ptr) = source_map.expr_syntax(call_id) { 266 if let Ok(source_ptr) = source_map.expr_syntax(call_id) {
267 if is_method_call { 267 if is_method_call {
268 param_count -= 1; 268 param_count -= 1;
@@ -287,7 +287,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
287 infer: Arc<InferenceResult>, 287 infer: Arc<InferenceResult>,
288 ) { 288 ) {
289 let (body, source_map): (Arc<Body>, Arc<BodySourceMap>) = 289 let (body, source_map): (Arc<Body>, Arc<BodySourceMap>) =
290 db.body_with_source_map(self.owner.into()); 290 db.body_with_source_map(self.owner);
291 291
292 let match_expr_ty = if infer.type_of_expr[match_expr].is_unknown() { 292 let match_expr_ty = if infer.type_of_expr[match_expr].is_unknown() {
293 return; 293 return;
@@ -393,7 +393,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
393 }; 393 };
394 394
395 if params.len() > 0 && params[0] == mismatch.actual { 395 if params.len() > 0 && params[0] == mismatch.actual {
396 let (_, source_map) = db.body_with_source_map(self.owner.into()); 396 let (_, source_map) = db.body_with_source_map(self.owner);
397 397
398 if let Ok(source_ptr) = source_map.expr_syntax(id) { 398 if let Ok(source_ptr) = source_map.expr_syntax(id) {
399 self.sink.push(MissingOkOrSomeInTailExpr { 399 self.sink.push(MissingOkOrSomeInTailExpr {
@@ -425,7 +425,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
425 return; 425 return;
426 } 426 }
427 427
428 let (_, source_map) = db.body_with_source_map(self.owner.into()); 428 let (_, source_map) = db.body_with_source_map(self.owner);
429 429
430 if let Ok(source_ptr) = source_map.expr_syntax(possible_tail_id) { 430 if let Ok(source_ptr) = source_map.expr_syntax(possible_tail_id) {
431 self.sink 431 self.sink
diff --git a/crates/hir_ty/src/diagnostics/unsafe_check.rs b/crates/hir_ty/src/diagnostics/unsafe_check.rs
index 44a7e5506..1f49a4909 100644
--- a/crates/hir_ty/src/diagnostics/unsafe_check.rs
+++ b/crates/hir_ty/src/diagnostics/unsafe_check.rs
@@ -29,7 +29,7 @@ impl<'a, 'b> UnsafeValidator<'a, 'b> {
29 } 29 }
30 30
31 pub(super) fn validate_body(&mut self, db: &dyn HirDatabase) { 31 pub(super) fn validate_body(&mut self, db: &dyn HirDatabase) {
32 let def = self.owner.into(); 32 let def = self.owner;
33 let unsafe_expressions = unsafe_expressions(db, self.infer.as_ref(), def); 33 let unsafe_expressions = unsafe_expressions(db, self.infer.as_ref(), def);
34 let is_unsafe = match self.owner { 34 let is_unsafe = match self.owner {
35 DefWithBodyId::FunctionId(it) => db.function_data(it).qualifier.is_unsafe, 35 DefWithBodyId::FunctionId(it) => db.function_data(it).qualifier.is_unsafe,
diff --git a/crates/hir_ty/src/traits/chalk/mapping.rs b/crates/hir_ty/src/traits/chalk/mapping.rs
index 524814f43..d969527dc 100644
--- a/crates/hir_ty/src/traits/chalk/mapping.rs
+++ b/crates/hir_ty/src/traits/chalk/mapping.rs
@@ -52,7 +52,7 @@ impl ToChalk for Ty {
52 52
53 TyKind::Tuple(cardinality, substs) => { 53 TyKind::Tuple(cardinality, substs) => {
54 let substitution = substs.to_chalk(db); 54 let substitution = substs.to_chalk(db);
55 chalk_ir::TyKind::Tuple(cardinality.into(), substitution).intern(&Interner) 55 chalk_ir::TyKind::Tuple(cardinality, substitution).intern(&Interner)
56 } 56 }
57 TyKind::Raw(mutability, ty) => { 57 TyKind::Raw(mutability, ty) => {
58 let ty = ty.to_chalk(db); 58 let ty = ty.to_chalk(db);
diff --git a/crates/ide/src/diagnostics/fixes.rs b/crates/ide/src/diagnostics/fixes.rs
index cbfc66ab3..2f840909c 100644
--- a/crates/ide/src/diagnostics/fixes.rs
+++ b/crates/ide/src/diagnostics/fixes.rs
@@ -180,7 +180,7 @@ fn missing_record_expr_field_fix(
180 let def_id = sema.resolve_variant(record_lit)?; 180 let def_id = sema.resolve_variant(record_lit)?;
181 let module; 181 let module;
182 let def_file_id; 182 let def_file_id;
183 let record_fields = match VariantDef::from(def_id) { 183 let record_fields = match def_id {
184 VariantDef::Struct(s) => { 184 VariantDef::Struct(s) => {
185 module = s.module(sema.db); 185 module = s.module(sema.db);
186 let source = s.source(sema.db)?; 186 let source = s.source(sema.db)?;
diff --git a/crates/ide_completion/src/completions.rs b/crates/ide_completion/src/completions.rs
index 3b582ed07..09882c4f3 100644
--- a/crates/ide_completion/src/completions.rs
+++ b/crates/ide_completion/src/completions.rs
@@ -56,7 +56,7 @@ impl Builder {
56 56
57impl Completions { 57impl Completions {
58 pub(crate) fn add(&mut self, item: CompletionItem) { 58 pub(crate) fn add(&mut self, item: CompletionItem) {
59 self.buf.push(item.into()) 59 self.buf.push(item)
60 } 60 }
61 61
62 pub(crate) fn add_all<I>(&mut self, items: I) 62 pub(crate) fn add_all<I>(&mut self, items: I)
diff --git a/crates/ide_completion/src/completions/postfix/format_like.rs b/crates/ide_completion/src/completions/postfix/format_like.rs
index cee4eec10..3f1c6730b 100644
--- a/crates/ide_completion/src/completions/postfix/format_like.rs
+++ b/crates/ide_completion/src/completions/postfix/format_like.rs
@@ -89,7 +89,7 @@ enum State {
89impl FormatStrParser { 89impl FormatStrParser {
90 pub(crate) fn new(input: String) -> Self { 90 pub(crate) fn new(input: String) -> Self {
91 Self { 91 Self {
92 input: input.into(), 92 input: input,
93 output: String::new(), 93 output: String::new(),
94 extracted_expressions: Vec::new(), 94 extracted_expressions: Vec::new(),
95 state: State::NotExpr, 95 state: State::NotExpr,
diff --git a/crates/ide_db/src/defs.rs b/crates/ide_db/src/defs.rs
index f86e5ce93..75167ff39 100644
--- a/crates/ide_db/src/defs.rs
+++ b/crates/ide_db/src/defs.rs
@@ -181,7 +181,7 @@ impl NameClass {
181 }, 181 },
182 ast::SelfParam(it) => { 182 ast::SelfParam(it) => {
183 let def = sema.to_def(&it)?; 183 let def = sema.to_def(&it)?;
184 Some(NameClass::Definition(Definition::Local(def.into()))) 184 Some(NameClass::Definition(Definition::Local(def)))
185 }, 185 },
186 ast::RecordField(it) => { 186 ast::RecordField(it) => {
187 let field: hir::Field = sema.to_def(&it)?; 187 let field: hir::Field = sema.to_def(&it)?;
diff --git a/crates/ide_db/src/helpers/insert_use.rs b/crates/ide_db/src/helpers/insert_use.rs
index df66d8ea0..9e0cb91c3 100644
--- a/crates/ide_db/src/helpers/insert_use.rs
+++ b/crates/ide_db/src/helpers/insert_use.rs
@@ -80,7 +80,7 @@ impl ImportScope {
80 }) 80 })
81 .last() 81 .last()
82 .map(|last_inner_element| { 82 .map(|last_inner_element| {
83 (InsertPosition::After(last_inner_element.into()), AddBlankLine::BeforeTwice) 83 (InsertPosition::After(last_inner_element), AddBlankLine::BeforeTwice)
84 }) 84 })
85 .unwrap_or_else(|| self.first_insert_pos()) 85 .unwrap_or_else(|| self.first_insert_pos())
86 } 86 }
diff --git a/crates/mbe/src/benchmark.rs b/crates/mbe/src/benchmark.rs
index 503ad1355..bd8ea6452 100644
--- a/crates/mbe/src/benchmark.rs
+++ b/crates/mbe/src/benchmark.rs
@@ -120,7 +120,7 @@ fn invocation_fixtures(rules: &FxHashMap<String, MacroRules>) -> Vec<(String, tt
120 Some("pat") => parent.token_trees.push(make_ident("foo")), 120 Some("pat") => parent.token_trees.push(make_ident("foo")),
121 Some("path") => parent.token_trees.push(make_ident("foo")), 121 Some("path") => parent.token_trees.push(make_ident("foo")),
122 Some("literal") => parent.token_trees.push(make_literal("1")), 122 Some("literal") => parent.token_trees.push(make_literal("1")),
123 Some("expr") => parent.token_trees.push(make_ident("foo").into()), 123 Some("expr") => parent.token_trees.push(make_ident("foo")),
124 Some("lifetime") => { 124 Some("lifetime") => {
125 parent.token_trees.push(make_punct('\'')); 125 parent.token_trees.push(make_punct('\''));
126 parent.token_trees.push(make_ident("a")); 126 parent.token_trees.push(make_ident("a"));
@@ -157,17 +157,15 @@ fn invocation_fixtures(rules: &FxHashMap<String, MacroRules>) -> Vec<(String, tt
157 if i + 1 != cnt { 157 if i + 1 != cnt {
158 if let Some(sep) = separator { 158 if let Some(sep) = separator {
159 match sep { 159 match sep {
160 Separator::Literal(it) => parent 160 Separator::Literal(it) => {
161 .token_trees 161 parent.token_trees.push(tt::Leaf::Literal(it.clone()).into())
162 .push(tt::Leaf::Literal(it.clone().into()).into()), 162 }
163 Separator::Ident(it) => parent 163 Separator::Ident(it) => {
164 .token_trees 164 parent.token_trees.push(tt::Leaf::Ident(it.clone()).into())
165 .push(tt::Leaf::Ident(it.clone().into()).into()), 165 }
166 Separator::Puncts(puncts) => { 166 Separator::Puncts(puncts) => {
167 for it in puncts { 167 for it in puncts {
168 parent 168 parent.token_trees.push(tt::Leaf::Punct(it.clone()).into())
169 .token_trees
170 .push(tt::Leaf::Punct(it.clone().into()).into())
171 } 169 }
172 } 170 }
173 }; 171 };
diff --git a/crates/mbe/src/expander/matcher.rs b/crates/mbe/src/expander/matcher.rs
index 2c69e8968..1bf7c2e81 100644
--- a/crates/mbe/src/expander/matcher.rs
+++ b/crates/mbe/src/expander/matcher.rs
@@ -722,7 +722,7 @@ fn match_meta_var(kind: &str, input: &mut TtIter) -> ExpandResult<Option<Fragmen
722 input 722 input
723 .expect_literal() 723 .expect_literal()
724 .map(|literal| { 724 .map(|literal| {
725 let lit = tt::Leaf::from(literal.clone()); 725 let lit = literal.clone();
726 match neg { 726 match neg {
727 None => Some(lit.into()), 727 None => Some(lit.into()),
728 Some(neg) => Some(tt::TokenTree::Subtree(tt::Subtree { 728 Some(neg) => Some(tt::TokenTree::Subtree(tt::Subtree {
diff --git a/crates/mbe/src/syntax_bridge.rs b/crates/mbe/src/syntax_bridge.rs
index b715ebfc4..85163c4b3 100644
--- a/crates/mbe/src/syntax_bridge.rs
+++ b/crates/mbe/src/syntax_bridge.rs
@@ -130,7 +130,7 @@ pub fn parse_exprs_with_sep(tt: &tt::Subtree, sep: char) -> Vec<tt::Subtree> {
130 res.push(match expanded.value { 130 res.push(match expanded.value {
131 None => break, 131 None => break,
132 Some(tt @ tt::TokenTree::Leaf(_)) => { 132 Some(tt @ tt::TokenTree::Leaf(_)) => {
133 tt::Subtree { delimiter: None, token_trees: vec![tt.into()] } 133 tt::Subtree { delimiter: None, token_trees: vec![tt] }
134 } 134 }
135 Some(tt::TokenTree::Subtree(tt)) => tt, 135 Some(tt::TokenTree::Subtree(tt)) => tt,
136 }); 136 });
@@ -727,7 +727,7 @@ impl<'a> TreeSink for TtTreeSink<'a> {
727 // Note: We always assume the semi-colon would be the last token in 727 // Note: We always assume the semi-colon would be the last token in
728 // other parts of RA such that we don't add whitespace here. 728 // other parts of RA such that we don't add whitespace here.
729 if curr.spacing == tt::Spacing::Alone && curr.char != ';' { 729 if curr.spacing == tt::Spacing::Alone && curr.char != ';' {
730 self.inner.token(WHITESPACE, " ".into()); 730 self.inner.token(WHITESPACE, " ");
731 self.text_pos += TextSize::of(' '); 731 self.text_pos += TextSize::of(' ');
732 } 732 }
733 } 733 }
diff --git a/crates/mbe/src/tests.rs b/crates/mbe/src/tests.rs
index eca0bcc18..25c374b9b 100644
--- a/crates/mbe/src/tests.rs
+++ b/crates/mbe/src/tests.rs
@@ -35,7 +35,7 @@ mod rule_parsing {
35 fn test_invalid_arms() { 35 fn test_invalid_arms() {
36 fn check(macro_body: &str, err: ParseError) { 36 fn check(macro_body: &str, err: ParseError) {
37 let m = parse_macro_arm(macro_body); 37 let m = parse_macro_arm(macro_body);
38 assert_eq!(m, Err(err.into())); 38 assert_eq!(m, Err(err));
39 } 39 }
40 check("invalid", ParseError::Expected("expected subtree".into())); 40 check("invalid", ParseError::Expected("expected subtree".into()));
41 41
diff --git a/crates/proc_macro_api/src/rpc.rs b/crates/proc_macro_api/src/rpc.rs
index 64cfdafc5..9a68e2cc5 100644
--- a/crates/proc_macro_api/src/rpc.rs
+++ b/crates/proc_macro_api/src/rpc.rs
@@ -236,13 +236,10 @@ mod tests {
236 subtree 236 subtree
237 .token_trees 237 .token_trees
238 .push(TokenTree::Leaf(Ident { text: "Foo".into(), id: TokenId(1) }.into())); 238 .push(TokenTree::Leaf(Ident { text: "Foo".into(), id: TokenId(1) }.into()));
239 subtree.token_trees.push(TokenTree::Subtree( 239 subtree.token_trees.push(TokenTree::Subtree(Subtree {
240 Subtree { 240 delimiter: Some(Delimiter { id: TokenId(2), kind: DelimiterKind::Brace }),
241 delimiter: Some(Delimiter { id: TokenId(2), kind: DelimiterKind::Brace }), 241 token_trees: vec![],
242 token_trees: vec![], 242 }));
243 }
244 .into(),
245 ));
246 subtree 243 subtree
247 } 244 }
248 245
diff --git a/crates/rust-analyzer/src/lsp_utils.rs b/crates/rust-analyzer/src/lsp_utils.rs
index 3ca7f8040..2ac487632 100644
--- a/crates/rust-analyzer/src/lsp_utils.rs
+++ b/crates/rust-analyzer/src/lsp_utils.rs
@@ -36,7 +36,7 @@ impl Progress {
36 36
37impl GlobalState { 37impl GlobalState {
38 pub(crate) fn show_message(&mut self, typ: lsp_types::MessageType, message: String) { 38 pub(crate) fn show_message(&mut self, typ: lsp_types::MessageType, message: String) {
39 let message = message.into(); 39 let message = message;
40 self.send_notification::<lsp_types::notification::ShowMessage>( 40 self.send_notification::<lsp_types::notification::ShowMessage>(
41 lsp_types::ShowMessageParams { typ, message }, 41 lsp_types::ShowMessageParams { typ, message },
42 ) 42 )
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs
index 70eaae5e8..c63fe2915 100644
--- a/crates/rust-analyzer/src/to_proto.rs
+++ b/crates/rust-analyzer/src/to_proto.rs
@@ -287,7 +287,7 @@ pub(crate) fn signature_help(
287 let params = call_info 287 let params = call_info
288 .parameter_ranges() 288 .parameter_ranges()
289 .iter() 289 .iter()
290 .map(|it| [u32::from(it.start()).into(), u32::from(it.end()).into()]) 290 .map(|it| [u32::from(it.start()), u32::from(it.end())])
291 .map(|label_offsets| lsp_types::ParameterInformation { 291 .map(|label_offsets| lsp_types::ParameterInformation {
292 label: lsp_types::ParameterLabel::LabelOffsets(label_offsets), 292 label: lsp_types::ParameterLabel::LabelOffsets(label_offsets),
293 documentation: None, 293 documentation: None,
diff --git a/crates/syntax/src/ast/edit.rs b/crates/syntax/src/ast/edit.rs
index 0b3b76d4a..64fac13a7 100644
--- a/crates/syntax/src/ast/edit.rs
+++ b/crates/syntax/src/ast/edit.rs
@@ -479,7 +479,7 @@ impl ast::MatchArmList {
479 Some(t) => t, 479 Some(t) => t,
480 None => return self.clone(), 480 None => return self.clone(),
481 }; 481 };
482 let position = InsertPosition::Before(r_curly.into()); 482 let position = InsertPosition::Before(r_curly);
483 let arm_ws = tokens::WsBuilder::new(" "); 483 let arm_ws = tokens::WsBuilder::new(" ");
484 let match_indent = &leading_indent(self.syntax()).unwrap_or_default(); 484 let match_indent = &leading_indent(self.syntax()).unwrap_or_default();
485 let match_ws = tokens::WsBuilder::new(&format!("\n{}", match_indent)); 485 let match_ws = tokens::WsBuilder::new(&format!("\n{}", match_indent));
diff --git a/crates/syntax/src/ted.rs b/crates/syntax/src/ted.rs
index 76f950ef9..442dfa14a 100644
--- a/crates/syntax/src/ted.rs
+++ b/crates/syntax/src/ted.rs
@@ -122,5 +122,5 @@ fn ws_between(left: &SyntaxElement, right: &SyntaxElement) -> Option<SyntaxToken
122 if right.kind() == T![;] || right.kind() == T![,] { 122 if right.kind() == T![;] || right.kind() == T![,] {
123 return None; 123 return None;
124 } 124 }
125 Some(make::tokens::single_space().into()) 125 Some(make::tokens::single_space())
126} 126}