mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Remove non-needed clones
I am not certain if this will improve performance, but it seems having a .clone() without any need should be removed. This was done with clippy, and manually reviewed: ``` cargo clippy --fix -- -A clippy::all -D clippy::redundant_clone ```
This commit is contained in:
parent
a06525517b
commit
1d59c7b667
21 changed files with 25 additions and 33 deletions
|
@ -16,7 +16,7 @@ fn render(ctx: RenderContext<'_>, const_: hir::Const) -> Option<CompletionItem>
|
|||
let (name, escaped_name) = (name.unescaped().to_smol_str(), name.to_smol_str());
|
||||
let detail = const_.display(db).to_string();
|
||||
|
||||
let mut item = CompletionItem::new(SymbolKind::Const, ctx.source_range(), name.clone());
|
||||
let mut item = CompletionItem::new(SymbolKind::Const, ctx.source_range(), name);
|
||||
item.set_documentation(ctx.docs(const_))
|
||||
.set_deprecated(ctx.is_deprecated(const_) || ctx.is_deprecated_assoc_item(const_))
|
||||
.detail(detail)
|
||||
|
|
|
@ -84,7 +84,7 @@ fn render(
|
|||
}
|
||||
_ => RenderedLiteral {
|
||||
literal: escaped_qualified_name.clone(),
|
||||
detail: escaped_qualified_name.clone(),
|
||||
detail: escaped_qualified_name,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ fn render(
|
|||
};
|
||||
let detail = type_alias.display(db).to_string();
|
||||
|
||||
let mut item = CompletionItem::new(SymbolKind::TypeAlias, ctx.source_range(), name.clone());
|
||||
let mut item = CompletionItem::new(SymbolKind::TypeAlias, ctx.source_range(), name);
|
||||
item.set_documentation(ctx.docs(type_alias))
|
||||
.set_deprecated(ctx.is_deprecated(type_alias) || ctx.is_deprecated_assoc_item(type_alias))
|
||||
.detail(detail)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue