Skip to content

Commit bfb8f73

Browse files
Merge #10545
10545: A few clippy fixes r=Veykril a=Milo123459 A few clippy fixes Co-authored-by: Milo <[email protected]>
2 parents 0af9d1f + 35de195 commit bfb8f73

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

crates/cfg/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ impl CfgDiff {
113113
pub fn len(&self) -> usize {
114114
self.enable.len() + self.disable.len()
115115
}
116+
117+
pub fn is_empty(&self) -> bool {
118+
self.len() == 0
119+
}
116120
}
117121

118122
impl fmt::Display for CfgDiff {

crates/flycheck/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ impl CargoActor {
297297
read_at_least_one_message = true;
298298

299299
// Try to deserialize a message from Cargo or Rustc.
300-
let mut deserializer = serde_json::Deserializer::from_str(&line);
300+
let mut deserializer = serde_json::Deserializer::from_str(line);
301301
deserializer.disable_recursion_limit();
302302
if let Ok(message) = JsonMessage::deserialize(&mut deserializer) {
303303
match message {

crates/ide/src/goto_declaration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ mod tests {
5757
.unwrap()
5858
.expect("no declaration or definition found")
5959
.info;
60-
if navs.len() == 0 {
60+
if navs.is_empty() {
6161
panic!("unresolved reference")
6262
}
6363

crates/ide/src/syntax_highlighting/highlight.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ fn parents_match(mut node: NodeOrToken<SyntaxNode, SyntaxToken>, mut kinds: &[Sy
741741
}
742742

743743
// Only true if we matched all expected kinds
744-
kinds.len() == 0
744+
kinds.is_empty()
745745
}
746746

747747
#[inline]

crates/syntax/test_data/parser/fuzz-failures/0000.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ pub /*(meh)*/ fn replace_range(mut text: String, range: TextRange, replace_with:
101101
}
102102

103103
fn is_balanced(tokens: &[Token]) -> bool {
104-
if tokens.len() == 0
104+
if tokens.is_empty()
105105
|| tokens.first().unwrap().kind != L_CURLY
106106
|| tokens.last().unwrap().kind != R_CURLY {
107107
return false
@@ -153,7 +153,7 @@ pub /*(meh)*/ fn replace_range(mut text: String, range: TextRange, replace_with:
153153
}
154154

155155
fn is_balanced(tokens: &[Token]) -> bool {
156-
if tokens.len() == 0
156+
if tokens.is_empty()
157157
|| tokens.first().unwrap().kind != L_CURLY
158158
|| tokens.last().unwrap().kind != R_CURLY {
159159
return false

0 commit comments

Comments
 (0)