Enable and fix several more clippy lints.
This commit is contained in:
@@ -18,8 +18,8 @@ pub struct Encoding {
|
||||
|
||||
impl Encoding {
|
||||
/// Create a new `Encoding` containing `(recipe, bits)`.
|
||||
pub fn new(recipe: u16, bits: u16) -> Encoding {
|
||||
Encoding { recipe, bits }
|
||||
pub fn new(recipe: u16, bits: u16) -> Self {
|
||||
Self { recipe, bits }
|
||||
}
|
||||
|
||||
/// Get the recipe number in this encoding.
|
||||
@@ -122,10 +122,10 @@ impl EncInfo {
|
||||
///
|
||||
/// Returns 0 for illegal encodings.
|
||||
pub fn bytes(&self, enc: Encoding) -> CodeOffset {
|
||||
self.sizing
|
||||
.get(enc.recipe())
|
||||
.map(|s| CodeOffset::from(s.bytes))
|
||||
.unwrap_or(0)
|
||||
self.sizing.get(enc.recipe()).map_or(
|
||||
0,
|
||||
|s| CodeOffset::from(s.bytes),
|
||||
)
|
||||
}
|
||||
|
||||
/// Get the branch range that is supported by `enc`, if any.
|
||||
|
||||
@@ -24,8 +24,8 @@ struct Args {
|
||||
}
|
||||
|
||||
impl Args {
|
||||
fn new(bits: u16, enable_e: bool) -> Args {
|
||||
Args {
|
||||
fn new(bits: u16, enable_e: bool) -> Self {
|
||||
Self {
|
||||
pointer_bits: bits,
|
||||
pointer_bytes: u32::from(bits) / 8,
|
||||
pointer_type: Type::int(bits).unwrap(),
|
||||
|
||||
@@ -23,10 +23,10 @@ pub struct StackRef {
|
||||
|
||||
impl StackRef {
|
||||
/// Get a reference to the stack slot `ss` using one of the base pointers in `mask`.
|
||||
pub fn masked(ss: StackSlot, mask: StackBaseMask, frame: &StackSlots) -> Option<StackRef> {
|
||||
pub fn masked(ss: StackSlot, mask: StackBaseMask, frame: &StackSlots) -> Option<Self> {
|
||||
// Try an SP-relative reference.
|
||||
if mask.contains(StackBase::SP) {
|
||||
return Some(StackRef::sp(ss, frame));
|
||||
return Some(Self::sp(ss, frame));
|
||||
}
|
||||
|
||||
// No reference possible with this mask.
|
||||
@@ -34,7 +34,7 @@ impl StackRef {
|
||||
}
|
||||
|
||||
/// Get a reference to `ss` using the stack pointer as a base.
|
||||
pub fn sp(ss: StackSlot, frame: &StackSlots) -> StackRef {
|
||||
pub fn sp(ss: StackSlot, frame: &StackSlots) -> Self {
|
||||
let size = frame.frame_size.expect(
|
||||
"Stack layout must be computed before referencing stack slots",
|
||||
);
|
||||
@@ -48,7 +48,7 @@ impl StackRef {
|
||||
let sp_offset = -(size as StackOffset);
|
||||
slot.offset.unwrap() - sp_offset
|
||||
};
|
||||
StackRef {
|
||||
Self {
|
||||
base: StackBase::SP,
|
||||
offset,
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@ struct Args {
|
||||
}
|
||||
|
||||
impl Args {
|
||||
fn new(bits: u16, gpr: &'static [RU], fpr_limit: usize, call_conv: CallConv) -> Args {
|
||||
Args {
|
||||
fn new(bits: u16, gpr: &'static [RU], fpr_limit: usize, call_conv: CallConv) -> Self {
|
||||
Self {
|
||||
pointer_bytes: u32::from(bits) / 8,
|
||||
pointer_bits: bits,
|
||||
pointer_type: ir::Type::int(bits).unwrap(),
|
||||
@@ -44,7 +44,7 @@ impl Args {
|
||||
fpr_limit,
|
||||
fpr_used: 0,
|
||||
offset: 0,
|
||||
call_conv: call_conv,
|
||||
call_conv,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -205,7 +205,7 @@ fn callee_saved_gprs_used(flags: &shared_settings::Flags, func: &ir::Function) -
|
||||
}
|
||||
|
||||
used.intersect(&all_callee_saved);
|
||||
return used;
|
||||
used
|
||||
}
|
||||
|
||||
pub fn prologue_epilogue(func: &mut ir::Function, isa: &TargetIsa) -> result::CtonResult {
|
||||
|
||||
Reference in New Issue
Block a user