Skip to content

Commit

Permalink
Update Linter
Browse files Browse the repository at this point in the history
  • Loading branch information
mrodz committed Aug 17, 2024
1 parent d10b6b4 commit 39bdd50
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 22 deletions.
5 changes: 5 additions & 0 deletions bytecode/src/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,11 @@ impl BuiltInFunction {
unreachable!()
};

/*
* Clippy warns about this. Again, if a user makes a map with
* a mutable type and mutates it... that's on them.
*/
#[allow(clippy::mutable_key_type)]
let raw_map = map.0.borrow().clone();

Ok((Some(Primitive::Map(GcMap::new(raw_map))), None))
Expand Down
16 changes: 0 additions & 16 deletions compiler/src/ast/math_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,22 +450,6 @@ impl Dependencies for Expr {
x
}
E::ReferenceToSelf(..) => vec![],
#[cfg(not)]
E::ReferenceToSelf(reference_to_self) => {
let reference_to_self = match reference_to_self.borrow().clone() {
ReferenceToSelf::Class(class) => TypeLayout::Class(class.clone()),
_ => {
log::warn!("Invalid reference to self");
return vec![];
}
};
let self_dependency = Dependency::new(Cow::Owned(Ident::new(
"self".to_owned(),
Some(Cow::Owned(reference_to_self)),
false,
)));
vec![self_dependency]
}
E::ReferenceToConstructor(..) => vec![],
E::Nil => vec![],
E::UnaryUnwrap { value, .. } => value.net_dependencies(),
Expand Down
10 changes: 4 additions & 6 deletions compiler/src/ast/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1317,12 +1317,10 @@ impl TypeLayout {
vec![Cow::Owned(map_type.key_type().clone())],
map_type.value_type().clone().optional_of().into()
)),
"clone" => {
return Some(new_assoc_function!(
vec![],
ScopeReturnStatus::Should(Cow::Owned(TypeLayout::Map(map_type.clone())))
))
}
"clone" => Some(new_assoc_function!(
vec![],
ScopeReturnStatus::Should(Cow::Owned(TypeLayout::Map(map_type.clone())))
)),
_ => None,
},
_ => None,
Expand Down
4 changes: 4 additions & 0 deletions compiler/src/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ impl ScopeReturnStatus {

#[derive(Debug)]
pub(crate) struct Scope {
#[warn(clippy::mutable_key_type)]
variables: HashSet<Ident>,
types: HashMap<Box<str>, Cow<'static, TypeLayout>>,
ty: ScopeType,
Expand All @@ -455,6 +456,9 @@ impl Display for Scope {
}

impl Scope {
/// # Safety
/// [`Ident`] is hashed by const name only, hence it is safe to ignore clippy
#[allow(clippy::mutable_key_type)]
const fn new(
variables: HashSet<Ident>,
types: HashMap<Box<str>, Cow<'static, TypeLayout>>,
Expand Down

0 comments on commit 39bdd50

Please sign in to comment.