diff --git a/crates/hir_def/src/generics.rs b/crates/hir_def/src/generics.rs index 8622357cd42..98eafa9000c 100644 --- a/crates/hir_def/src/generics.rs +++ b/crates/hir_def/src/generics.rs @@ -392,7 +392,7 @@ fn child_source( // For traits the first type index is `Self`, we need to add it before the other params. if let GenericDefId::TraitId(id) = *self { - let trait_ref = id.lookup(db).source(db).value.clone(); + let trait_ref = id.lookup(db).source(db).value; let idx = idx_iter.next().unwrap(); params.insert(idx, Either::Right(trait_ref)) } diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs index adaaece719f..9a879715e7b 100644 --- a/crates/ide/src/doc_links.rs +++ b/crates/ide/src/doc_links.rs @@ -254,7 +254,7 @@ pub(crate) fn get_definition_with_descend_at( let original_start = doc_token.text_range().start(); let relative_comment_offset = offset - original_start - prefix_len; - sema.descend_into_macros_many(doc_token.clone()).into_iter().find_map(|t| { + sema.descend_into_macros_many(doc_token).into_iter().find_map(|t| { let (node, descended_prefix_len) = match_ast! { match t { ast::Comment(comment) => (t.parent()?, TextSize::try_from(comment.prefix().len()).ok()?), diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index 911998d69b5..718c31f9bc8 100644 --- a/crates/ide/src/goto_definition.rs +++ b/crates/ide/src/goto_definition.rs @@ -47,7 +47,7 @@ pub(crate) fn goto_definition( .into_iter() .filter_map(|token| { let parent = token.parent()?; - if let Some(tt) = ast::TokenTree::cast(parent.clone()) { + if let Some(tt) = ast::TokenTree::cast(parent) { if let x @ Some(_) = try_lookup_include_path(&sema, tt, token.clone(), position.file_id) { @@ -77,7 +77,7 @@ fn try_lookup_include_path( token: SyntaxToken, file_id: FileId, ) -> Option> { - let token = ast::String::cast(token.clone())?; + let token = ast::String::cast(token)?; let path = token.value()?.into_owned(); let macro_call = tt.syntax().parent().and_then(ast::MacroCall::cast)?; let name = macro_call.path()?.segment()?.name_ref()?; diff --git a/crates/ide_assists/src/handlers/extract_function.rs b/crates/ide_assists/src/handlers/extract_function.rs index a367d97afed..401fb78f986 100644 --- a/crates/ide_assists/src/handlers/extract_function.rs +++ b/crates/ide_assists/src/handlers/extract_function.rs @@ -169,7 +169,7 @@ fn extraction_target(node: &SyntaxNode, selection_range: TextRange) -> Option ( hir::ModPath::from_segments(hir::PathKind::Plain, iter::once(name.clone())), - hir::ModPath::from_segments(hir::PathKind::Plain, iter::once(name.clone())), + hir::ModPath::from_segments(hir::PathKind::Plain, iter::once(name)), ), }; diff --git a/crates/ide_diagnostics/src/handlers/missing_fields.rs b/crates/ide_diagnostics/src/handlers/missing_fields.rs index 03656ad925b..d5b84715156 100644 --- a/crates/ide_diagnostics/src/handlers/missing_fields.rs +++ b/crates/ide_diagnostics/src/handlers/missing_fields.rs @@ -58,7 +58,7 @@ fn fixes(ctx: &DiagnosticsContext<'_>, d: &hir::MissingFields) -> Option Id { let doc_id = self.get_file_id(file_id); let line_index = self.db.line_index(file_id); let line_index = LineIndex { - index: line_index.clone(), + index: line_index, encoding: OffsetEncoding::Utf16, endings: LineEndings::Unix, }; @@ -191,7 +191,7 @@ fn add_file(&mut self, file: StaticIndexedFile) { let text = self.analysis.file_text(file_id).unwrap(); let line_index = self.db.line_index(file_id); let line_index = LineIndex { - index: line_index.clone(), + index: line_index, encoding: OffsetEncoding::Utf16, endings: LineEndings::Unix, }; diff --git a/crates/syntax/src/ast/expr_ext.rs b/crates/syntax/src/ast/expr_ext.rs index f421f34b3dc..28b4f5bc02e 100644 --- a/crates/syntax/src/ast/expr_ext.rs +++ b/crates/syntax/src/ast/expr_ext.rs @@ -336,7 +336,7 @@ fn cast(syntax: SyntaxNode) -> Option { if let Some(it) = ast::CallExpr::cast(syntax.clone()) { Some(Self::Call(it)) - } else if let Some(it) = ast::MethodCallExpr::cast(syntax.clone()) { + } else if let Some(it) = ast::MethodCallExpr::cast(syntax) { Some(Self::MethodCall(it)) } else { None