From 619a61529878f82daf7aed571bc4f6a10bd6dd9f Mon Sep 17 00:00:00 2001 From: Alan Du Date: Tue, 4 Jun 2019 02:28:22 -0400 Subject: Fix clippy::len_zero --- crates/ra_hir/src/path.rs | 4 ++-- crates/ra_ide_api/src/line_index.rs | 4 ++-- crates/ra_mbe/src/syntax_bridge.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/ra_hir/src/path.rs b/crates/ra_hir/src/path.rs index 1b129c752..67afd5027 100644 --- a/crates/ra_hir/src/path.rs +++ b/crates/ra_hir/src/path.rs @@ -116,7 +116,7 @@ impl Path { /// `true` if this path is just a standalone `self` pub fn is_self(&self) -> bool { - self.kind == PathKind::Self_ && self.segments.len() == 0 + self.kind == PathKind::Self_ && self.segments.is_empty() } /// If this path is a single identifier, like `foo`, return its name. @@ -140,7 +140,7 @@ impl GenericArgs { args.push(GenericArg::Type(type_ref)); } // lifetimes and assoc type args ignored for now - if args.len() > 0 { + if !args.is_empty() { Some(GenericArgs { args }) } else { None diff --git a/crates/ra_ide_api/src/line_index.rs b/crates/ra_ide_api/src/line_index.rs index fd33d6767..087dfafed 100644 --- a/crates/ra_ide_api/src/line_index.rs +++ b/crates/ra_ide_api/src/line_index.rs @@ -41,7 +41,7 @@ impl LineIndex { newlines.push(curr_row); // Save any utf-16 characters seen in the previous line - if utf16_chars.len() > 0 { + if !utf16_chars.is_empty() { utf16_lines.insert(line, utf16_chars); utf16_chars = Vec::new(); } @@ -61,7 +61,7 @@ impl LineIndex { } // Save any utf-16 characters seen in the last line - if utf16_chars.len() > 0 { + if !utf16_chars.is_empty() { utf16_lines.insert(line, utf16_chars); } diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs index 0edb6f9a2..e3f93b23c 100644 --- a/crates/ra_mbe/src/syntax_bridge.rs +++ b/crates/ra_mbe/src/syntax_bridge.rs @@ -292,7 +292,7 @@ fn delim_to_str(d: tt::Delimiter, closing: bool) -> SmolStr { }; let idx = closing as usize; - let text = if texts.len() > 0 { &texts[idx..texts.len() - (1 - idx)] } else { "" }; + let text = if !texts.is_empty() { &texts[idx..texts.len() - (1 - idx)] } else { "" }; text.into() } -- cgit v1.2.3