use strip_prefix() instead of starts_with and slicing (clippy::manual_strip)

This commit is contained in:
Matthias Krüger 2021-03-21 12:38:21 +01:00
parent 3d9b3a8575
commit 8a67116857
4 changed files with 9 additions and 13 deletions

View file

@ -333,8 +333,7 @@ impl ast::Use {
.and_then(ast::Whitespace::cast);
if let Some(next_ws) = next_ws {
let ws_text = next_ws.syntax().text();
if ws_text.starts_with('\n') {
let rest = &ws_text[1..];
if let Some(rest) = ws_text.strip_prefix('\n') {
if rest.is_empty() {
res.delete(next_ws.syntax())
} else {