Fix clippy lints

This commit is contained in:
Noah 2020-04-03 12:33:49 -05:00
parent 9ac8969e0d
commit 8df7d73211

View file

@ -78,15 +78,15 @@ pub fn compile(
match mode { match mode {
Mode::Exec => { Mode::Exec => {
let ast = parser::parse_program(source)?; let ast = parser::parse_program(source)?;
compile_program(ast, source_path.clone(), opts) compile_program(ast, source_path, opts)
} }
Mode::Eval => { Mode::Eval => {
let statement = parser::parse_statement(source)?; let statement = parser::parse_statement(source)?;
compile_statement_eval(statement, source_path.clone(), opts) compile_statement_eval(statement, source_path, opts)
} }
Mode::Single => { Mode::Single => {
let ast = parser::parse_program(source)?; let ast = parser::parse_program(source)?;
compile_program_single(ast, source_path.clone(), opts) compile_program_single(ast, source_path, opts)
} }
} }
} }
@ -2141,12 +2141,7 @@ impl<O: OutputStream> Compiler<O> {
features: &[ast::ImportSymbol], features: &[ast::ImportSymbol],
) -> Result<(), CompileError> { ) -> Result<(), CompileError> {
if self.done_with_future_stmts { if self.done_with_future_stmts {
return Err(CompileError { return Err(self.error(CompileErrorType::InvalidFuturePlacement));
error: CompileErrorType::InvalidFuturePlacement,
location: self.current_source_location.clone(),
source_path: self.source_path.clone(),
statement: None,
});
} }
for feature in features { for feature in features {
match &*feature.symbol { match &*feature.symbol {
@ -2156,12 +2151,7 @@ impl<O: OutputStream> Compiler<O> {
// "generator_stop" => {} // "generator_stop" => {}
// "annotations" => {} // "annotations" => {}
other => { other => {
return Err(CompileError { return Err(self.error(CompileErrorType::InvalidFutureFeature(other.to_owned())))
error: CompileErrorType::InvalidFutureFeature(other.to_owned()),
location: self.current_source_location.clone(),
source_path: self.source_path.clone(),
statement: None,
})
} }
} }
} }