Fix nightly clippy

This commit is contained in:
Jeong YunWon 2020-10-01 07:08:26 +09:00
parent 6c96793f05
commit 09b8414162
2 changed files with 6 additions and 21 deletions

View file

@ -61,10 +61,7 @@ enum FunctionContext {
impl CompileContext {
fn in_func(self) -> bool {
match self.func {
FunctionContext::NoFunction => false,
_ => true,
}
!matches!(self.func, FunctionContext::NoFunction)
}
}
@ -2006,13 +2003,9 @@ impl<O: OutputStream> Compiler<O> {
// a list of expressions on the stack, or a list of tuples.
fn gather_elements(&mut self, elements: &[ast::Expression]) -> CompileResult<bool> {
// First determine if we have starred elements:
let has_stars = elements.iter().any(|e| {
if let ast::ExpressionType::Starred { .. } = &e.node {
true
} else {
false
}
});
let has_stars = elements
.iter()
.any(|e| matches!(e.node, ast::ExpressionType::Starred { .. }));
for element in elements {
if let ast::ExpressionType::Starred { value } = &element.node {

View file

@ -136,19 +136,11 @@ impl Symbol {
}
pub fn is_global(&self) -> bool {
if let SymbolScope::Global = self.scope {
true
} else {
false
}
matches!(self.scope, SymbolScope::Global)
}
pub fn is_local(&self) -> bool {
if let SymbolScope::Local = self.scope {
true
} else {
false
}
matches!(self.scope, SymbolScope::Local)
}
}