10545: A few clippy fixes r=Veykril a=Milo123459

A few clippy fixes

Co-authored-by: Milo <50248166+Milo123459@users.noreply.github.com>
This commit is contained in:
bors[bot]
2021-10-14 20:10:59 +00:00
committed by GitHub
5 changed files with 9 additions and 5 deletions
+4
View File
@@ -113,6 +113,10 @@ pub fn new(enable: Vec<CfgAtom>, disable: Vec<CfgAtom>) -> Option<CfgDiff> {
pub fn len(&self) -> usize {
self.enable.len() + self.disable.len()
}
pub fn is_empty(&self) -> bool {
self.len() == 0
}
}
impl fmt::Display for CfgDiff {
+1 -1
View File
@@ -297,7 +297,7 @@ fn run(self, command: Command) -> io::Result<()> {
read_at_least_one_message = true;
// 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();
if let Ok(message) = JsonMessage::deserialize(&mut deserializer) {
match message {
+1 -1
View File
@@ -57,7 +57,7 @@ fn check(ra_fixture: &str) {
.unwrap()
.expect("no declaration or definition found")
.info;
if navs.len() == 0 {
if navs.is_empty() {
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
kinds.len() == 0
kinds.is_empty()
}
#[inline]
@@ -101,7 +101,7 @@ fn reparser(node: SyntaxNodeRef) -> Option<fn(&mut Parser)> {
}
fn is_balanced(tokens: &[Token]) -> bool {
if tokens.len() == 0
if tokens.is_empty()
|| tokens.first().unwrap().kind != L_CURLY
|| tokens.last().unwrap().kind != R_CURLY {
return false
@@ -153,7 +153,7 @@ fn reparser(node: SyntaxNodeRef) -> Option<fn(&mut Parser)> {
}
fn is_balanced(tokens: &[Token]) -> bool {
if tokens.len() == 0
if tokens.is_empty()
|| tokens.first().unwrap().kind != L_CURLY
|| tokens.last().unwrap().kind != R_CURLY {
return false