1
Fork 0

Fix even more clippy warnings

This commit is contained in:
Joshua Nelson 2020-10-26 21:02:48 -04:00
parent bfecb18771
commit 57c6ed0c07
53 changed files with 276 additions and 520 deletions

View file

@ -474,31 +474,19 @@ impl<'a, Ty> ArgAbi<'a, Ty> {
}
pub fn is_indirect(&self) -> bool {
match self.mode {
PassMode::Indirect(..) => true,
_ => false,
}
matches!(self.mode, PassMode::Indirect(..))
}
pub fn is_sized_indirect(&self) -> bool {
match self.mode {
PassMode::Indirect(_, None) => true,
_ => false,
}
matches!(self.mode, PassMode::Indirect(_, None))
}
pub fn is_unsized_indirect(&self) -> bool {
match self.mode {
PassMode::Indirect(_, Some(_)) => true,
_ => false,
}
matches!(self.mode, PassMode::Indirect(_, Some(_)))
}
pub fn is_ignore(&self) -> bool {
match self.mode {
PassMode::Ignore => true,
_ => false,
}
matches!(self.mode, PassMode::Ignore)
}
}

View file

@ -333,10 +333,8 @@ where
let mut avail_gprs = 8;
let mut avail_fprs = 8;
if !fn_abi.ret.is_ignore() {
if classify_ret(cx, &mut fn_abi.ret, xlen, flen) {
avail_gprs -= 1;
}
if !fn_abi.ret.is_ignore() && classify_ret(cx, &mut fn_abi.ret, xlen, flen) {
avail_gprs -= 1;
}
for (i, arg) in fn_abi.args.iter_mut().enumerate() {

View file

@ -24,10 +24,8 @@ where
C: LayoutOf<Ty = Ty, TyAndLayout = TyAndLayout<'a, Ty>> + HasDataLayout,
{
ret.extend_integer_width_to(32);
if ret.layout.is_aggregate() {
if !unwrap_trivial_aggregate(cx, ret) {
ret.make_indirect();
}
if ret.layout.is_aggregate() && !unwrap_trivial_aggregate(cx, ret) {
ret.make_indirect();
}
}
@ -37,10 +35,8 @@ where
C: LayoutOf<Ty = Ty, TyAndLayout = TyAndLayout<'a, Ty>> + HasDataLayout,
{
arg.extend_integer_width_to(32);
if arg.layout.is_aggregate() {
if !unwrap_trivial_aggregate(cx, arg) {
arg.make_indirect_byval();
}
if arg.layout.is_aggregate() && !unwrap_trivial_aggregate(cx, arg) {
arg.make_indirect_byval();
}
}

View file

@ -557,17 +557,11 @@ impl Primitive {
}
pub fn is_float(self) -> bool {
match self {
F32 | F64 => true,
_ => false,
}
matches!(self, F32 | F64)
}
pub fn is_int(self) -> bool {
match self {
Int(..) => true,
_ => false,
}
matches!(self, Int(..))
}
}
@ -794,18 +788,12 @@ impl Abi {
/// Returns `true` if this is an uninhabited type
pub fn is_uninhabited(&self) -> bool {
match *self {
Abi::Uninhabited => true,
_ => false,
}
matches!(*self, Abi::Uninhabited)
}
/// Returns `true` is this is a scalar type
pub fn is_scalar(&self) -> bool {
match *self {
Abi::Scalar(_) => true,
_ => false,
}
matches!(*self, Abi::Scalar(_))
}
}

View file

@ -478,10 +478,7 @@ pub enum InlineAsmType {
impl InlineAsmType {
pub fn is_integer(self) -> bool {
match self {
Self::I8 | Self::I16 | Self::I32 | Self::I64 | Self::I128 => true,
_ => false,
}
matches!(self, Self::I8 | Self::I16 | Self::I32 | Self::I64 | Self::I128)
}
pub fn size(self) -> Size {