new rustfmt and clippy

This commit is contained in:
Anton-4 2021-02-20 20:00:37 +01:00
parent dfaa280a88
commit b098d13407
4 changed files with 38 additions and 16 deletions

View file

@ -229,7 +229,11 @@ fn flatten<'a>(
tag_name,
layout,
} if union.alternatives.len() == 1
&& !matches!(layout, Layout::Union(UnionLayout::NullableWrapped { .. })| Layout::Union(UnionLayout::NullableUnwrapped { .. })) =>
&& !matches!(
layout,
Layout::Union(UnionLayout::NullableWrapped { .. })
| Layout::Union(UnionLayout::NullableUnwrapped { .. })
) =>
{
// TODO ^ do we need to check that guard.is_none() here?

View file

@ -643,7 +643,10 @@ impl<'a> Layout<'a> {
Union(variant) => {
use UnionLayout::*;
matches!(variant, Recursive(_)| NullableWrapped { .. } | NullableUnwrapped { .. })
matches!(
variant,
Recursive(_) | NullableWrapped { .. } | NullableUnwrapped { .. }
)
}
RecursivePointer => true,

View file

@ -1628,10 +1628,18 @@ fn to_diff<'b>(
ErrorType::Alias(Symbol::NUM_INT, _, _) => true,
ErrorType::Type(Symbol::NUM_NUM, args) => {
matches!( &args.get(0) ,Some(ErrorType::Type(Symbol::NUM_INTEGER, _)) | Some(ErrorType::Alias(Symbol::NUM_INTEGER, _, _)))
matches!(
&args.get(0),
Some(ErrorType::Type(Symbol::NUM_INTEGER, _))
| Some(ErrorType::Alias(Symbol::NUM_INTEGER, _, _))
)
}
ErrorType::Alias(Symbol::NUM_NUM, args, _) => {
matches!(&args.get(0), Some((_, ErrorType::Type(Symbol::NUM_INTEGER, _))) | Some((_, ErrorType::Alias(Symbol::NUM_INTEGER, _, _))))
matches!(
&args.get(0),
Some((_, ErrorType::Type(Symbol::NUM_INTEGER, _)))
| Some((_, ErrorType::Alias(Symbol::NUM_INTEGER, _, _)))
)
}
_ => false,
};
@ -1640,11 +1648,19 @@ fn to_diff<'b>(
ErrorType::Alias(Symbol::NUM_FLOAT, _, _) => true,
ErrorType::Type(Symbol::NUM_NUM, args) => {
matches!(&args.get(0), Some(ErrorType::Type(Symbol::NUM_FLOATINGPOINT, _)) | Some(ErrorType::Alias(Symbol::NUM_FLOATINGPOINT, _, _)))
matches!(
&args.get(0),
Some(ErrorType::Type(Symbol::NUM_FLOATINGPOINT, _))
| Some(ErrorType::Alias(Symbol::NUM_FLOATINGPOINT, _, _))
)
}
ErrorType::Alias(Symbol::NUM_NUM, args, _) => {
matches!(&args.get(0), Some((_, ErrorType::Type(Symbol::NUM_FLOATINGPOINT, _))) | Some((_, ErrorType::Alias(Symbol::NUM_FLOATINGPOINT, _, _))))
matches!(
&args.get(0),
Some((_, ErrorType::Type(Symbol::NUM_FLOATINGPOINT, _)))
| Some((_, ErrorType::Alias(Symbol::NUM_FLOATINGPOINT, _, _)))
)
}
_ => false,
};

View file

@ -648,10 +648,10 @@ impl Type {
// attribute on the recursion variable must match the uniqueness of the whole tag
// union. We enforce that here.
if let Some(rec_uvar) = find_rec_var_uniqueness(base_type, aliases) {
if let Bool::Container(unbound_cvar, mvars1) = rec_uvar {
if let Type::Boolean(Bool::Container(bound_cvar, mvars2)) = uniqueness_type
if let Some(Bool::Container(unbound_cvar, mvars1)) =
find_rec_var_uniqueness(base_type, aliases)
{
if let Type::Boolean(Bool::Container(bound_cvar, mvars2)) = uniqueness_type {
debug_assert!(mvars1.is_empty());
debug_assert!(mvars2.is_empty());
@ -661,7 +661,6 @@ impl Type {
}
}
}
}
Apply(symbol, args) => {
if let Some(alias) = aliases.get(symbol) {
if args.len() != alias.vars.len() {