diff --git a/bytecode/src/function.rs b/bytecode/src/function.rs index 49ab28d..c7d4d24 100644 --- a/bytecode/src/function.rs +++ b/bytecode/src/function.rs @@ -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)) diff --git a/compiler/src/ast/math_expr.rs b/compiler/src/ast/math_expr.rs index 2f9d914..ead46c8 100644 --- a/compiler/src/ast/math_expr.rs +++ b/compiler/src/ast/math_expr.rs @@ -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(), diff --git a/compiler/src/ast/type.rs b/compiler/src/ast/type.rs index d933df9..e805c07 100644 --- a/compiler/src/ast/type.rs +++ b/compiler/src/ast/type.rs @@ -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, diff --git a/compiler/src/scope.rs b/compiler/src/scope.rs index f25528b..bee5bd0 100644 --- a/compiler/src/scope.rs +++ b/compiler/src/scope.rs @@ -436,6 +436,7 @@ impl ScopeReturnStatus { #[derive(Debug)] pub(crate) struct Scope { + #[warn(clippy::mutable_key_type)] variables: HashSet, types: HashMap, Cow<'static, TypeLayout>>, ty: ScopeType, @@ -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, types: HashMap, Cow<'static, TypeLayout>>,