diff options
author | Matthias Krüger <[email protected]> | 2021-03-21 11:38:21 +0000 |
---|---|---|
committer | Matthias Krüger <[email protected]> | 2021-03-21 11:38:21 +0000 |
commit | 8a671168576b9b552a22be285646fc293a80d8c2 (patch) | |
tree | 4c2a4f07acfc73de24e9ab1ce16ce7b556c6b6d4 /crates/hir_expand | |
parent | 3d9b3a8575ef3cb557fd847b941000df3b2db670 (diff) |
use strip_prefix() instead of starts_with and slicing (clippy::manual_strip)
Diffstat (limited to 'crates/hir_expand')
-rw-r--r-- | crates/hir_expand/src/name.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/hir_expand/src/name.rs b/crates/hir_expand/src/name.rs index 43de9edd6..0aeea48d5 100644 --- a/crates/hir_expand/src/name.rs +++ b/crates/hir_expand/src/name.rs | |||
@@ -48,9 +48,8 @@ impl Name { | |||
48 | 48 | ||
49 | /// Resolve a name from the text of token. | 49 | /// Resolve a name from the text of token. |
50 | fn resolve(raw_text: &str) -> Name { | 50 | fn resolve(raw_text: &str) -> Name { |
51 | let raw_start = "r#"; | 51 | if let Some(text) = raw_text.strip_prefix("r#") { |
52 | if raw_text.starts_with(raw_start) { | 52 | Name::new_text(SmolStr::new(text)) |
53 | Name::new_text(SmolStr::new(&raw_text[raw_start.len()..])) | ||
54 | } else { | 53 | } else { |
55 | Name::new_text(raw_text.into()) | 54 | Name::new_text(raw_text.into()) |
56 | } | 55 | } |