aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/src/ast/edit.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-03-21 15:49:31 +0000
committerGitHub <[email protected]>2021-03-21 15:49:31 +0000
commitd51cf133f68eec63eee27a8666c7590d2e8b4ef8 (patch)
treecd74909ed13e4a697459bf66afffcb06d89820cd /crates/syntax/src/ast/edit.rs
parent5bb65bb4962cfad613e9744a340ae23b533f479e (diff)
parent202b51bc7b6999900e06ec2cfb8d72fe9aa4af29 (diff)
Merge #8135
8135: more clippy::{perf, complexity, style} fixes r=Veykril a=matthiaskrgr Co-authored-by: Matthias Krüger <[email protected]>
Diffstat (limited to 'crates/syntax/src/ast/edit.rs')
-rw-r--r--crates/syntax/src/ast/edit.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/crates/syntax/src/ast/edit.rs b/crates/syntax/src/ast/edit.rs
index 64fac13a7..347862b8a 100644
--- a/crates/syntax/src/ast/edit.rs
+++ b/crates/syntax/src/ast/edit.rs
@@ -333,8 +333,7 @@ impl ast::Use {
333 .and_then(ast::Whitespace::cast); 333 .and_then(ast::Whitespace::cast);
334 if let Some(next_ws) = next_ws { 334 if let Some(next_ws) = next_ws {
335 let ws_text = next_ws.syntax().text(); 335 let ws_text = next_ws.syntax().text();
336 if ws_text.starts_with('\n') { 336 if let Some(rest) = ws_text.strip_prefix('\n') {
337 let rest = &ws_text[1..];
338 if rest.is_empty() { 337 if rest.is_empty() {
339 res.delete(next_ws.syntax()) 338 res.delete(next_ws.syntax())
340 } else { 339 } else {
@@ -462,8 +461,7 @@ impl ast::MatchArmList {
462 let end = if let Some(comma) = start 461 let end = if let Some(comma) = start
463 .siblings_with_tokens(Direction::Next) 462 .siblings_with_tokens(Direction::Next)
464 .skip(1) 463 .skip(1)
465 .skip_while(|it| it.kind().is_trivia()) 464 .find(|it| !it.kind().is_trivia())
466 .next()
467 .filter(|it| it.kind() == T![,]) 465 .filter(|it| it.kind() == T![,])
468 { 466 {
469 comma 467 comma
@@ -597,7 +595,7 @@ impl IndentLevel {
597 pub fn from_node(node: &SyntaxNode) -> IndentLevel { 595 pub fn from_node(node: &SyntaxNode) -> IndentLevel {
598 match node.first_token() { 596 match node.first_token() {
599 Some(it) => Self::from_token(&it), 597 Some(it) => Self::from_token(&it),
600 None => return IndentLevel(0), 598 None => IndentLevel(0),
601 } 599 }
602 } 600 }
603 601