mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
ide: Fix warnings about clippy str_to_string
rule
This commit is contained in:
parent
bb0de88f24
commit
8c2f301a41
17 changed files with 38 additions and 41 deletions
|
@ -58,7 +58,7 @@ pub(crate) fn rewrite_links(db: &RootDatabase, markdown: &str, definition: Defin
|
|||
// and valid URLs so we choose to be too eager to try to resolve what might be
|
||||
// a URL.
|
||||
if target.contains("://") {
|
||||
(Some(LinkType::Inline), target.to_string(), title.to_string())
|
||||
(Some(LinkType::Inline), target.to_owned(), title.to_owned())
|
||||
} else {
|
||||
// Two possibilities:
|
||||
// * path-based links: `../../module/struct.MyStruct.html`
|
||||
|
@ -66,9 +66,9 @@ pub(crate) fn rewrite_links(db: &RootDatabase, markdown: &str, definition: Defin
|
|||
if let Some((target, title)) = rewrite_intra_doc_link(db, definition, target, title) {
|
||||
(None, target, title)
|
||||
} else if let Some(target) = rewrite_url_link(db, definition, target) {
|
||||
(Some(LinkType::Inline), target, title.to_string())
|
||||
(Some(LinkType::Inline), target, title.to_owned())
|
||||
} else {
|
||||
(None, target.to_string(), title.to_string())
|
||||
(None, target.to_owned(), title.to_owned())
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -186,7 +186,7 @@ pub(crate) fn extract_definitions_from_docs(
|
|||
let (link, ns) = parse_intra_doc_link(&target);
|
||||
Some((
|
||||
TextRange::new(range.start.try_into().ok()?, range.end.try_into().ok()?),
|
||||
link.to_string(),
|
||||
link.to_owned(),
|
||||
ns,
|
||||
))
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ fn rewrite_intra_doc_link(
|
|||
url = url.join(&file).ok()?;
|
||||
url.set_fragment(anchor);
|
||||
|
||||
Some((url.into(), strip_prefixes_suffixes(title).to_string()))
|
||||
Some((url.into(), strip_prefixes_suffixes(title).to_owned()))
|
||||
}
|
||||
|
||||
/// Try to resolve path to local documentation via path-based links (i.e. `../gateway/struct.Shard.html`).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue