chore: deal with clippy warnings

This commit is contained in:
rvcas 2022-11-10 01:24:40 -05:00 committed by Lucas
parent 4e05a28e59
commit 01e91b9fe5
3 changed files with 7 additions and 1 deletions

View File

@ -1093,6 +1093,7 @@ impl<'a> Environment<'a> {
/// Any unbound type variables will be linked to the other type as they are the same. /// Any unbound type variables will be linked to the other type as they are the same.
/// ///
/// It two types are found to not be the same an error is returned. /// It two types are found to not be the same an error is returned.
#[allow(clippy::only_used_in_recursion)]
pub fn unify(&mut self, t1: Arc<Type>, t2: Arc<Type>, location: Span) -> Result<(), Error> { pub fn unify(&mut self, t1: Arc<Type>, t2: Arc<Type>, location: Span) -> Result<(), Error> {
if t1 == t2 { if t1 == t2 {
return Ok(()); return Ok(());
@ -1536,6 +1537,7 @@ fn get_compatible_record_fields<A>(
/// Takes a level and a type and turns all type variables within the type that have /// Takes a level and a type and turns all type variables within the type that have
/// level higher than the input level into generalized (polymorphic) type variables. /// level higher than the input level into generalized (polymorphic) type variables.
#[allow(clippy::only_used_in_recursion)]
pub(crate) fn generalise(t: Arc<Type>, ctx_level: usize) -> Arc<Type> { pub(crate) fn generalise(t: Arc<Type>, ctx_level: usize) -> Arc<Type> {
match t.deref() { match t.deref() {
Type::Var { tipo } => match tipo.borrow().deref() { Type::Var { tipo } => match tipo.borrow().deref() {

View File

@ -649,7 +649,7 @@ impl<'a> CodeGenerator<'a> {
let index = let index =
dt.constructors.iter().position(|c| name.clone() == c.name); dt.constructors.iter().position(|c| name.clone() == c.name);
data_type = dt.name.clone(); data_type = dt.name.clone();
current_module = module.clone().unwrap_or_else(|| "".to_string()); current_module = module.clone().unwrap_or_default();
total_constr_length = dt.constructors.len(); total_constr_length = dt.constructors.len();
index.unwrap_or(dt.constructors.len()) index.unwrap_or(dt.constructors.len())

View File

@ -214,6 +214,7 @@ impl Converter {
Ok(converted_term) Ok(converted_term)
} }
#[allow(clippy::only_used_in_recursion)]
pub fn named_debruijn_to_debruijn(&mut self, term: &Term<NamedDeBruijn>) -> Term<DeBruijn> { pub fn named_debruijn_to_debruijn(&mut self, term: &Term<NamedDeBruijn>) -> Term<DeBruijn> {
match term { match term {
Term::Var(name) => Term::Var(name.clone().into()), Term::Var(name) => Term::Var(name.clone().into()),
@ -236,6 +237,7 @@ impl Converter {
} }
} }
#[allow(clippy::only_used_in_recursion)]
pub fn debruijn_to_named_debruijn(&mut self, term: &Term<DeBruijn>) -> Term<NamedDeBruijn> { pub fn debruijn_to_named_debruijn(&mut self, term: &Term<DeBruijn>) -> Term<NamedDeBruijn> {
match term { match term {
Term::Var(name) => Term::Var((*name).into()), Term::Var(name) => Term::Var((*name).into()),
@ -258,6 +260,7 @@ impl Converter {
} }
} }
#[allow(clippy::only_used_in_recursion)]
pub fn fake_named_debruijn_to_named_debruijn( pub fn fake_named_debruijn_to_named_debruijn(
&mut self, &mut self,
term: &Term<FakeNamedDeBruijn>, term: &Term<FakeNamedDeBruijn>,
@ -287,6 +290,7 @@ impl Converter {
} }
} }
#[allow(clippy::only_used_in_recursion)]
pub fn named_debruijn_to_fake_named_debruijn( pub fn named_debruijn_to_fake_named_debruijn(
&mut self, &mut self,
term: &Term<NamedDeBruijn>, term: &Term<NamedDeBruijn>,