Fix clippy warnings.

This commit fixes the current set of (stable) clippy warnings in the repo.
This commit is contained in:
Peter Huene
2019-10-23 23:15:42 -07:00
committed by Andrew Brown
parent 1176e4f178
commit 9f506692c2
93 changed files with 667 additions and 662 deletions

View File

@@ -70,7 +70,7 @@ impl GlobalValueData {
/// Assume that `self` is an `GlobalValueData::Symbol` and return its name.
pub fn symbol_name(&self) -> &ExternalName {
match *self {
GlobalValueData::Symbol { ref name, .. } => name,
Self::Symbol { ref name, .. } => name,
_ => panic!("only symbols have names"),
}
}
@@ -78,11 +78,8 @@ impl GlobalValueData {
/// Return the type of this global.
pub fn global_type(&self, isa: &dyn TargetIsa) -> Type {
match *self {
GlobalValueData::VMContext { .. } | GlobalValueData::Symbol { .. } => {
isa.pointer_type()
}
GlobalValueData::IAddImm { global_type, .. }
| GlobalValueData::Load { global_type, .. } => global_type,
Self::VMContext { .. } | Self::Symbol { .. } => isa.pointer_type(),
Self::IAddImm { global_type, .. } | Self::Load { global_type, .. } => global_type,
}
}
}
@@ -90,8 +87,8 @@ impl GlobalValueData {
impl fmt::Display for GlobalValueData {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
GlobalValueData::VMContext => write!(f, "vmctx"),
GlobalValueData::Load {
Self::VMContext => write!(f, "vmctx"),
Self::Load {
base,
offset,
global_type,
@@ -104,12 +101,12 @@ impl fmt::Display for GlobalValueData {
base,
offset
),
GlobalValueData::IAddImm {
Self::IAddImm {
global_type,
base,
offset,
} => write!(f, "iadd_imm.{} {}, {}", global_type, base, offset),
GlobalValueData::Symbol {
Self::Symbol {
ref name,
offset,
colocated,