1
Fork 0

Fix uninlined_format_args for some compiler crates

Convert all the crates that have had their diagnostic migration
completed (except save_analysis because that will be deleted soon and
apfloat because of the licensing problem).
This commit is contained in:
nils 2022-12-19 10:31:55 +01:00 committed by Nilstrieb
parent 1d284af117
commit fd7a159710
91 changed files with 287 additions and 329 deletions

View file

@ -177,12 +177,12 @@ impl Reg {
17..=32 => dl.i32_align.abi,
33..=64 => dl.i64_align.abi,
65..=128 => dl.i128_align.abi,
_ => panic!("unsupported integer: {:?}", self),
_ => panic!("unsupported integer: {self:?}"),
},
RegKind::Float => match self.size.bits() {
32 => dl.f32_align.abi,
64 => dl.f64_align.abi,
_ => panic!("unsupported float: {:?}", self),
_ => panic!("unsupported float: {self:?}"),
},
RegKind::Vector => dl.vector_align(self.size).abi,
}
@ -642,7 +642,7 @@ impl fmt::Display for AdjustForForeignAbiError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Unsupported { arch, abi } => {
write!(f, "target architecture {:?} does not support `extern {}` ABI", arch, abi)
write!(f, "target architecture {arch:?} does not support `extern {abi}` ABI")
}
}
}
@ -760,7 +760,7 @@ impl FromStr for Conv {
"AmdGpuKernel" => Ok(Conv::AmdGpuKernel),
"AvrInterrupt" => Ok(Conv::AvrInterrupt),
"AvrNonBlockingInterrupt" => Ok(Conv::AvrNonBlockingInterrupt),
_ => Err(format!("'{}' is not a valid value for entry function call convetion.", s)),
_ => Err(format!("'{s}' is not a valid value for entry function call convetion.")),
}
}
}

View file

@ -195,6 +195,6 @@ impl AArch64InlineAsmReg {
(modifier.unwrap_or('v'), self as u32 - Self::v0 as u32)
};
assert!(index < 32);
write!(out, "{}{}", prefix, index)
write!(out, "{prefix}{index}")
}
}

View file

@ -249,7 +249,7 @@ impl ArmInlineAsmReg {
let index = self as u32 - Self::q0 as u32;
assert!(index < 16);
let index = index * 2 + (modifier == 'f') as u32;
write!(out, "d{}", index)
write!(out, "d{index}")
} else {
out.write_str(self.name())
}

View file

@ -679,13 +679,13 @@ impl fmt::Display for InlineAsmType {
Self::I128 => f.write_str("i128"),
Self::F32 => f.write_str("f32"),
Self::F64 => f.write_str("f64"),
Self::VecI8(n) => write!(f, "i8x{}", n),
Self::VecI16(n) => write!(f, "i16x{}", n),
Self::VecI32(n) => write!(f, "i32x{}", n),
Self::VecI64(n) => write!(f, "i64x{}", n),
Self::VecI128(n) => write!(f, "i128x{}", n),
Self::VecF32(n) => write!(f, "f32x{}", n),
Self::VecF64(n) => write!(f, "f64x{}", n),
Self::VecI8(n) => write!(f, "i8x{n}"),
Self::VecI16(n) => write!(f, "i16x{n}"),
Self::VecI32(n) => write!(f, "i32x{n}"),
Self::VecI64(n) => write!(f, "i64x{n}"),
Self::VecI128(n) => write!(f, "i128x{n}"),
Self::VecF32(n) => write!(f, "f32x{n}"),
Self::VecF64(n) => write!(f, "f64x{n}"),
}
}
}

View file

@ -357,28 +357,28 @@ impl X86InlineAsmReg {
if self as u32 <= Self::dx as u32 {
let root = ['a', 'b', 'c', 'd'][self as usize - Self::ax as usize];
match modifier.unwrap_or(reg_default_modifier) {
'l' => write!(out, "{}l", root),
'h' => write!(out, "{}h", root),
'x' => write!(out, "{}x", root),
'e' => write!(out, "e{}x", root),
'r' => write!(out, "r{}x", root),
'l' => write!(out, "{root}l"),
'h' => write!(out, "{root}h"),
'x' => write!(out, "{root}x"),
'e' => write!(out, "e{root}x"),
'r' => write!(out, "r{root}x"),
_ => unreachable!(),
}
} else if self as u32 <= Self::di as u32 {
let root = self.name();
match modifier.unwrap_or(reg_default_modifier) {
'l' => write!(out, "{}l", root),
'x' => write!(out, "{}", root),
'e' => write!(out, "e{}", root),
'r' => write!(out, "r{}", root),
'l' => write!(out, "{root}l"),
'x' => write!(out, "{root}"),
'e' => write!(out, "e{root}"),
'r' => write!(out, "r{root}"),
_ => unreachable!(),
}
} else if self as u32 <= Self::r15 as u32 {
let root = self.name();
match modifier.unwrap_or(reg_default_modifier) {
'l' => write!(out, "{}b", root),
'x' => write!(out, "{}w", root),
'e' => write!(out, "{}d", root),
'l' => write!(out, "{root}b"),
'x' => write!(out, "{root}w"),
'e' => write!(out, "{root}d"),
'r' => out.write_str(root),
_ => unreachable!(),
}
@ -387,15 +387,15 @@ impl X86InlineAsmReg {
} else if self as u32 <= Self::xmm15 as u32 {
let prefix = modifier.unwrap_or('x');
let index = self as u32 - Self::xmm0 as u32;
write!(out, "{}{}", prefix, index)
write!(out, "{prefix}{index}")
} else if self as u32 <= Self::ymm15 as u32 {
let prefix = modifier.unwrap_or('y');
let index = self as u32 - Self::ymm0 as u32;
write!(out, "{}{}", prefix, index)
write!(out, "{prefix}{index}")
} else if self as u32 <= Self::zmm31 as u32 {
let prefix = modifier.unwrap_or('z');
let index = self as u32 - Self::zmm0 as u32;
write!(out, "{}{}", prefix, index)
write!(out, "{prefix}{index}")
} else {
out.write_str(self.name())
}

View file

@ -76,7 +76,7 @@ impl Arch {
fn pre_link_args(os: &'static str, arch: Arch, abi: &'static str) -> LinkArgs {
let platform_name: StaticCow<str> = match abi {
"sim" => format!("{}-simulator", os).into(),
"sim" => format!("{os}-simulator").into(),
"macabi" => "mac-catalyst".into(),
_ => os.into(),
};
@ -193,7 +193,7 @@ fn macos_deployment_target(arch: Arch) -> (u32, u32) {
fn macos_lld_platform_version(arch: Arch) -> String {
let (major, minor) = macos_deployment_target(arch);
format!("{}.{}", major, minor)
format!("{major}.{minor}")
}
pub fn macos_llvm_target(arch: Arch) -> String {
@ -252,7 +252,7 @@ pub fn ios_llvm_target(arch: Arch) -> String {
fn ios_lld_platform_version() -> String {
let (major, minor) = ios_deployment_target();
format!("{}.{}", major, minor)
format!("{major}.{minor}")
}
pub fn ios_sim_llvm_target(arch: Arch) -> String {
@ -266,7 +266,7 @@ fn tvos_deployment_target() -> (u32, u32) {
fn tvos_lld_platform_version() -> String {
let (major, minor) = tvos_deployment_target();
format!("{}.{}", major, minor)
format!("{major}.{minor}")
}
fn watchos_deployment_target() -> (u32, u32) {
@ -275,7 +275,7 @@ fn watchos_deployment_target() -> (u32, u32) {
fn watchos_lld_platform_version() -> String {
let (major, minor) = watchos_deployment_target();
format!("{}.{}", major, minor)
format!("{major}.{minor}")
}
pub fn watchos_sim_llvm_target(arch: Arch) -> String {

View file

@ -840,7 +840,7 @@ impl fmt::Display for SanitizerSet {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut first = true;
for s in *self {
let name = s.as_str().unwrap_or_else(|| panic!("unrecognized sanitizer {:?}", s));
let name = s.as_str().unwrap_or_else(|| panic!("unrecognized sanitizer {s:?}"));
if !first {
f.write_str(", ")?;
}
@ -2074,7 +2074,7 @@ impl Target {
let mut get_req_field = |name: &str| {
obj.remove(name)
.and_then(|j| j.as_str().map(str::to_string))
.ok_or_else(|| format!("Field {} in target specification is required", name))
.ok_or_else(|| format!("Field {name} in target specification is required"))
};
let mut base = Target {
@ -2480,7 +2480,7 @@ impl Target {
if let Some(s) = fp.as_str() {
base.frame_pointer = s
.parse()
.map_err(|()| format!("'{}' is not a valid value for frame-pointer", s))?;
.map_err(|()| format!("'{s}' is not a valid value for frame-pointer"))?;
} else {
incorrect_type.push("frame-pointer".into())
}
@ -2672,7 +2672,7 @@ impl Target {
return load_file(&p);
}
Err(format!("Could not find specification for target {:?}", target_triple))
Err(format!("Could not find specification for target {target_triple:?}"))
}
TargetTriple::TargetJson { ref contents, .. } => {
let obj = serde_json::from_str(contents).map_err(|e| e.to_string())?;
@ -2936,7 +2936,7 @@ impl TargetTriple {
let contents = std::fs::read_to_string(&canonicalized_path).map_err(|err| {
io::Error::new(
io::ErrorKind::InvalidInput,
format!("target path {:?} is not a valid file: {}", canonicalized_path, err),
format!("target path {canonicalized_path:?} is not a valid file: {err}"),
)
})?;
let triple = canonicalized_path
@ -2971,7 +2971,7 @@ impl TargetTriple {
let mut hasher = DefaultHasher::new();
content.hash(&mut hasher);
let hash = hasher.finish();
format!("{}-{}", triple, hash)
format!("{triple}-{hash}")
}
}
}

View file

@ -3,7 +3,7 @@ use crate::spec::TargetOptions;
pub fn opts(kernel: &str) -> TargetOptions {
TargetOptions {
os: format!("solid_{}", kernel).into(),
os: format!("solid_{kernel}").into(),
vendor: "kmc".into(),
executables: false,
frame_pointer: FramePointer::NonLeaf,