Skip to content

Commit f4a4b66

Browse files
ide-completion: Fix warnings about clippy str_to_string rule
1 parent 395708d commit f4a4b66

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

crates/ide-completion/src/completions/extern_crate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ mod other_mod {}
4646

4747
let completion_list = completion_list_no_kw(case);
4848

49-
assert_eq!("md other_crate_a\n".to_string(), completion_list);
49+
assert_eq!("md other_crate_a\n".to_owned(), completion_list);
5050
}
5151

5252
#[test]
@@ -66,6 +66,6 @@ mod other_mod {}
6666

6767
let completion_list = completion_list_no_kw(case);
6868

69-
assert_eq!("md other_crate_a\n".to_string(), completion_list);
69+
assert_eq!("md other_crate_a\n".to_owned(), completion_list);
7070
}
7171
}

crates/ide-completion/src/completions/postfix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ fn build_postfix_snippet_builder<'ctx>(
326326
delete_range: TextRange,
327327
) -> impl Fn(&str, &str, &str) -> Builder + 'ctx {
328328
move |label, detail, snippet| {
329-
let edit = TextEdit::replace(delete_range, snippet.to_string());
329+
let edit = TextEdit::replace(delete_range, snippet.to_owned());
330330
let mut item =
331331
CompletionItem::new(CompletionItemKind::Snippet, ctx.source_range(), label);
332332
item.detail(detail).snippet_edit(cap, edit);

crates/ide-completion/src/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ impl<'a> CompletionContext<'a> {
665665
// actual completion.
666666
let file_with_fake_ident = {
667667
let parse = db.parse(file_id);
668-
let edit = Indel::insert(offset, COMPLETION_MARKER.to_string());
668+
let edit = Indel::insert(offset, COMPLETION_MARKER.to_owned());
669669
parse.reparse(&edit).tree()
670670
};
671671

crates/ide-completion/src/item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ impl Builder {
553553
self.detail = detail.map(Into::into);
554554
if let Some(detail) = &self.detail {
555555
if never!(detail.contains('\n'), "multiline detail:\n{}", detail) {
556-
self.detail = Some(detail.split('\n').next().unwrap().to_string());
556+
self.detail = Some(detail.split('\n').next().unwrap().to_owned());
557557
}
558558
}
559559
self

crates/ide-completion/src/render.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,14 @@ pub(crate) fn render_field(
167167
if !expected_fn_type {
168168
if let Some(receiver) = &dot_access.receiver {
169169
if let Some(receiver) = ctx.completion.sema.original_ast_node(receiver.clone()) {
170-
builder.insert(receiver.syntax().text_range().start(), "(".to_string());
171-
builder.insert(ctx.source_range().end(), ")".to_string());
170+
builder.insert(receiver.syntax().text_range().start(), "(".to_owned());
171+
builder.insert(ctx.source_range().end(), ")".to_owned());
172172

173173
let is_parens_needed =
174174
!matches!(dot_access.kind, DotAccessKind::Method { has_parens: true });
175175

176176
if is_parens_needed {
177-
builder.insert(ctx.source_range().end(), "()".to_string());
177+
builder.insert(ctx.source_range().end(), "()".to_owned());
178178
}
179179
}
180180
}

crates/ide-completion/src/render/function.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,12 @@ pub(super) fn add_call_parens<'b>(
184184
}
185185
None => {
186186
let name = match param.ty().as_adt() {
187-
None => "_".to_string(),
187+
None => "_".to_owned(),
188188
Some(adt) => adt
189189
.name(ctx.db)
190190
.as_text()
191191
.map(|s| to_lower_snake_case(s.as_str()))
192-
.unwrap_or_else(|| "_".to_string()),
192+
.unwrap_or_else(|| "_".to_owned()),
193193
};
194194
f(&format_args!("${{{}:{name}}}", index + offset))
195195
}

crates/ide-completion/src/render/pattern.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ fn render_pat(
140140
StructKind::Record => {
141141
render_record_as_pat(ctx.db(), ctx.snippet_cap(), fields, name, fields_omitted)
142142
}
143-
StructKind::Unit => name.to_string(),
143+
StructKind::Unit => name.to_owned(),
144144
};
145145

146146
let needs_ascription = matches!(

crates/ide-completion/src/render/variant.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub(crate) fn render_record_lit(
2323
path: &str,
2424
) -> RenderedLiteral {
2525
if snippet_cap.is_none() {
26-
return RenderedLiteral { literal: path.to_string(), detail: path.to_string() };
26+
return RenderedLiteral { literal: path.to_owned(), detail: path.to_owned() };
2727
}
2828
let completions = fields.iter().enumerate().format_with(", ", |(idx, field), f| {
2929
if snippet_cap.is_some() {
@@ -52,7 +52,7 @@ pub(crate) fn render_tuple_lit(
5252
path: &str,
5353
) -> RenderedLiteral {
5454
if snippet_cap.is_none() {
55-
return RenderedLiteral { literal: path.to_string(), detail: path.to_string() };
55+
return RenderedLiteral { literal: path.to_owned(), detail: path.to_owned() };
5656
}
5757
let completions = fields.iter().enumerate().format_with(", ", |(idx, _), f| {
5858
if snippet_cap.is_some() {

0 commit comments

Comments
 (0)