Skip to content

Commit b3230e1

Browse files
committed
Clippy fix
1 parent c1c727c commit b3230e1

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

compat/src/parser_compat.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ macro_rules! parser_test {
131131
// Mostly matching the offsets and names
132132
#[cfg(test)]
133133
mod tests {
134-
use super::*;
135134

136135
// #[test]
137136
// fn test_simple_compat() {

parser/src/parser/compat.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(unused_variables)]
12
use crate::ast::*;
23
use crate::parser::parser::Parser;
34
use serde_json::{json, Value};

typechecker/src/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl<'a> BuildManager {
9898

9999
let span = span!(Level::TRACE, "type check", path = %path.display());
100100
let _guard = span.enter();
101-
let mut checker = TypeChecker::new(*id, &self);
101+
let mut checker = TypeChecker::new(*id, self);
102102
for stmt in file.tree.body.iter() {
103103
checker.type_check(stmt);
104104
}

typechecker/src/checker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use enderpy_python_parser::ast::{self, *};
66

77
use super::{type_evaluator::TypeEvaluator, types::PythonType};
88
use crate::build::BuildManager;
9-
use crate::symbol_table::{self, Id};
9+
use crate::symbol_table::Id;
1010
use crate::types::ModuleRef;
1111
use crate::{ast_visitor::TraversalVisitor, diagnostic::CharacterSpan};
1212
use rust_lapper::{Interval, Lapper};

typechecker/src/symbol_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ impl SymbolTable {
222222
pub fn get_scope(&self, pos: u32) -> u32 {
223223
let scope = self.scopes.iter().find(|scope| scope.start_pos == pos);
224224
if let Some(scope) = scope {
225-
return scope.id;
225+
scope.id
226226
} else {
227227
panic!("no scope found for position: {}", pos);
228228
}

typechecker/src/type_evaluator.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ impl<'a> TypeEvaluator<'a> {
707707
symbol_table.file_path,
708708
);
709709

710-
let find_in_current_symbol_table = symbol_table.lookup_in_scope(&name, scope_id);
710+
let find_in_current_symbol_table = symbol_table.lookup_in_scope(name, scope_id);
711711
if let Some(f) = find_in_current_symbol_table {
712712
return self.get_symbol_type(f, symbol_table, position);
713713
};
@@ -722,7 +722,7 @@ impl<'a> TypeEvaluator<'a> {
722722
for id in star_import.resolved_ids.iter() {
723723
let star_import_sym_table = self.build_manager.symbol_tables.get(id).unwrap();
724724
// In the star import we can only lookup the global scope
725-
let res = star_import_sym_table.lookup_in_scope(&name, 0);
725+
let res = star_import_sym_table.lookup_in_scope(name, 0);
726726
match res {
727727
Some(res) => {
728728
return self.get_symbol_type(res, symbol_table, position);
@@ -1172,7 +1172,7 @@ impl<'a> TypeEvaluator<'a> {
11721172
let found_declaration = match decl {
11731173
Declaration::Class(c) => {
11741174
let decl_scope = decl.declaration_path().scope_id;
1175-
self.get_class_declaration_type(&c, builtins_symbol_table, decl_scope)
1175+
self.get_class_declaration_type(c, builtins_symbol_table, decl_scope)
11761176
.unwrap_or_else(|_| {
11771177
panic!("Error getting type for builtin class: {:?}", c.class_node)
11781178
})
@@ -1699,14 +1699,14 @@ impl<'a> TypeEvaluator<'a> {
16991699

17001700
let mut new_class = class_type.clone();
17011701
new_class.specialized = resolved;
1702-
return PythonType::Class(new_class);
1702+
PythonType::Class(new_class)
17031703
}
17041704
PythonType::Instance(instance_type) => todo!(),
17051705
PythonType::Optional(python_type) => todo!(),
17061706
PythonType::TypeVar(type_var) => {
17071707
let name = type_var.name.as_str();
17081708
let mut index: Option<usize> = None;
1709-
for (i, tp) in type_parameters.into_iter().enumerate() {
1709+
for (i, tp) in type_parameters.iter().enumerate() {
17101710
let PythonType::TypeVar(ref tp) = tp else {
17111711
continue;
17121712
};
@@ -1720,8 +1720,8 @@ impl<'a> TypeEvaluator<'a> {
17201720
}
17211721

17221722
error!("Did not find type parameter {name}");
1723-
return python_type.clone();
1723+
python_type.clone()
17241724
}
1725-
};
1725+
}
17261726
}
17271727
}

typechecker/src/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl Display for CallableType {
103103
"(function) Callable ({}): {}",
104104
signature_str, self.return_type
105105
);
106-
return write!(f, "{}", fmt);
106+
write!(f, "{}", fmt)
107107
}
108108
}
109109

@@ -291,7 +291,7 @@ impl Display for InstanceType {
291291
self.class_type.details.qual_name, args_str
292292
)
293293
};
294-
return write!(f, "{}", fmt);
294+
write!(f, "{}", fmt)
295295
}
296296
}
297297

0 commit comments

Comments
 (0)