mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 15:32:06 +00:00
a few clippy fixes
This commit is contained in:
parent
e52d47a3b8
commit
35de195c41
@ -113,6 +113,10 @@ impl CfgDiff {
|
|||||||
pub fn len(&self) -> usize {
|
pub fn len(&self) -> usize {
|
||||||
self.enable.len() + self.disable.len()
|
self.enable.len() + self.disable.len()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_empty(&self) -> bool {
|
||||||
|
self.len() == 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for CfgDiff {
|
impl fmt::Display for CfgDiff {
|
||||||
|
@ -297,7 +297,7 @@ impl CargoActor {
|
|||||||
read_at_least_one_message = true;
|
read_at_least_one_message = true;
|
||||||
|
|
||||||
// Try to deserialize a message from Cargo or Rustc.
|
// Try to deserialize a message from Cargo or Rustc.
|
||||||
let mut deserializer = serde_json::Deserializer::from_str(&line);
|
let mut deserializer = serde_json::Deserializer::from_str(line);
|
||||||
deserializer.disable_recursion_limit();
|
deserializer.disable_recursion_limit();
|
||||||
if let Ok(message) = JsonMessage::deserialize(&mut deserializer) {
|
if let Ok(message) = JsonMessage::deserialize(&mut deserializer) {
|
||||||
match message {
|
match message {
|
||||||
|
@ -57,7 +57,7 @@ mod tests {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.expect("no declaration or definition found")
|
.expect("no declaration or definition found")
|
||||||
.info;
|
.info;
|
||||||
if navs.len() == 0 {
|
if navs.is_empty() {
|
||||||
panic!("unresolved reference")
|
panic!("unresolved reference")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -741,7 +741,7 @@ fn parents_match(mut node: NodeOrToken<SyntaxNode, SyntaxToken>, mut kinds: &[Sy
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Only true if we matched all expected kinds
|
// Only true if we matched all expected kinds
|
||||||
kinds.len() == 0
|
kinds.is_empty()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -101,7 +101,7 @@ pub /*(meh)*/ fn replace_range(mut text: String, range: TextRange, replace_with:
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn is_balanced(tokens: &[Token]) -> bool {
|
fn is_balanced(tokens: &[Token]) -> bool {
|
||||||
if tokens.len() == 0
|
if tokens.is_empty()
|
||||||
|| tokens.first().unwrap().kind != L_CURLY
|
|| tokens.first().unwrap().kind != L_CURLY
|
||||||
|| tokens.last().unwrap().kind != R_CURLY {
|
|| tokens.last().unwrap().kind != R_CURLY {
|
||||||
return false
|
return false
|
||||||
@ -153,7 +153,7 @@ pub /*(meh)*/ fn replace_range(mut text: String, range: TextRange, replace_with:
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn is_balanced(tokens: &[Token]) -> bool {
|
fn is_balanced(tokens: &[Token]) -> bool {
|
||||||
if tokens.len() == 0
|
if tokens.is_empty()
|
||||||
|| tokens.first().unwrap().kind != L_CURLY
|
|| tokens.first().unwrap().kind != L_CURLY
|
||||||
|| tokens.last().unwrap().kind != R_CURLY {
|
|| tokens.last().unwrap().kind != R_CURLY {
|
||||||
return false
|
return false
|
||||||
|
Loading…
Reference in New Issue
Block a user