aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAlan Du <[email protected]>2019-06-04 07:28:22 +0100
committerAlan Du <[email protected]>2019-06-04 23:05:07 +0100
commit619a61529878f82daf7aed571bc4f6a10bd6dd9f (patch)
tree5a4fa21a4410d353dd0522813df94cc6aea77cdd /crates
parent7bcd8d6290f63a725a62cc7da0269c08c1b6c99b (diff)
Fix clippy::len_zero
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/path.rs4
-rw-r--r--crates/ra_ide_api/src/line_index.rs4
-rw-r--r--crates/ra_mbe/src/syntax_bridge.rs2
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 {
116 116
117 /// `true` if this path is just a standalone `self` 117 /// `true` if this path is just a standalone `self`
118 pub fn is_self(&self) -> bool { 118 pub fn is_self(&self) -> bool {
119 self.kind == PathKind::Self_ && self.segments.len() == 0 119 self.kind == PathKind::Self_ && self.segments.is_empty()
120 } 120 }
121 121
122 /// If this path is a single identifier, like `foo`, return its name. 122 /// If this path is a single identifier, like `foo`, return its name.
@@ -140,7 +140,7 @@ impl GenericArgs {
140 args.push(GenericArg::Type(type_ref)); 140 args.push(GenericArg::Type(type_ref));
141 } 141 }
142 // lifetimes and assoc type args ignored for now 142 // lifetimes and assoc type args ignored for now
143 if args.len() > 0 { 143 if !args.is_empty() {
144 Some(GenericArgs { args }) 144 Some(GenericArgs { args })
145 } else { 145 } else {
146 None 146 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 {
41 newlines.push(curr_row); 41 newlines.push(curr_row);
42 42
43 // Save any utf-16 characters seen in the previous line 43 // Save any utf-16 characters seen in the previous line
44 if utf16_chars.len() > 0 { 44 if !utf16_chars.is_empty() {
45 utf16_lines.insert(line, utf16_chars); 45 utf16_lines.insert(line, utf16_chars);
46 utf16_chars = Vec::new(); 46 utf16_chars = Vec::new();
47 } 47 }
@@ -61,7 +61,7 @@ impl LineIndex {
61 } 61 }
62 62
63 // Save any utf-16 characters seen in the last line 63 // Save any utf-16 characters seen in the last line
64 if utf16_chars.len() > 0 { 64 if !utf16_chars.is_empty() {
65 utf16_lines.insert(line, utf16_chars); 65 utf16_lines.insert(line, utf16_chars);
66 } 66 }
67 67
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 {
292 }; 292 };
293 293
294 let idx = closing as usize; 294 let idx = closing as usize;
295 let text = if texts.len() > 0 { &texts[idx..texts.len() - (1 - idx)] } else { "" }; 295 let text = if !texts.is_empty() { &texts[idx..texts.len() - (1 - idx)] } else { "" };
296 text.into() 296 text.into()
297} 297}
298 298