xtask: Fix warnings about clippy str_to_string rule

This commit is contained in:
Tetsuharu Ohzeki 2024-02-10 00:56:07 +09:00
parent 283b140321
commit 06f3995ca9
5 changed files with 10 additions and 10 deletions

View file

@ -34,7 +34,7 @@ impl flags::Dist {
format!("{VERSION_NIGHTLY}.{patch_version}") format!("{VERSION_NIGHTLY}.{patch_version}")
}; };
dist_server(sh, &format!("{version}-standalone"), &target)?; dist_server(sh, &format!("{version}-standalone"), &target)?;
let release_tag = if stable { date_iso(sh)? } else { "nightly".to_string() }; let release_tag = if stable { date_iso(sh)? } else { "nightly".to_owned() };
dist_client(sh, &version, &release_tag, &target)?; dist_client(sh, &version, &release_tag, &target)?;
} else { } else {
dist_server(sh, "0.0.0-standalone", &target)?; dist_server(sh, "0.0.0-standalone", &target)?;
@ -155,11 +155,11 @@ impl Target {
Ok(target) => target, Ok(target) => target,
_ => { _ => {
if cfg!(target_os = "linux") { if cfg!(target_os = "linux") {
"x86_64-unknown-linux-gnu".to_string() "x86_64-unknown-linux-gnu".to_owned()
} else if cfg!(target_os = "windows") { } else if cfg!(target_os = "windows") {
"x86_64-pc-windows-msvc".to_string() "x86_64-pc-windows-msvc".to_owned()
} else if cfg!(target_os = "macos") { } else if cfg!(target_os = "macos") {
"x86_64-apple-darwin".to_string() "x86_64-apple-darwin".to_owned()
} else { } else {
panic!("Unsupported OS, maybe try setting RA_TARGET") panic!("Unsupported OS, maybe try setting RA_TARGET")
} }

View file

@ -129,7 +129,7 @@ impl FromStr for MeasurementType {
"webrender-2022" => Ok(Self::AnalyzeWebRender), "webrender-2022" => Ok(Self::AnalyzeWebRender),
"diesel-1.4.8" => Ok(Self::AnalyzeDiesel), "diesel-1.4.8" => Ok(Self::AnalyzeDiesel),
"hyper-0.14.18" => Ok(Self::AnalyzeHyper), "hyper-0.14.18" => Ok(Self::AnalyzeHyper),
_ => Err("Invalid option".to_string()), _ => Err("Invalid option".to_owned()),
} }
} }
} }

View file

@ -50,7 +50,7 @@ fn fix_path_for_mac(sh: &Shell) -> anyhow::Result<()> {
[ROOT_DIR, &home_dir] [ROOT_DIR, &home_dir]
.into_iter() .into_iter()
.map(|dir| dir.to_string() + COMMON_APP_PATH) .map(|dir| dir.to_owned() + COMMON_APP_PATH)
.map(PathBuf::from) .map(PathBuf::from)
.filter(|path| path.exists()) .filter(|path| path.exists())
.collect() .collect()

View file

@ -194,12 +194,12 @@ impl Host {
bail!("can only collect metrics on Linux "); bail!("can only collect metrics on Linux ");
} }
let os = read_field(sh, "/etc/os-release", "PRETTY_NAME=")?.trim_matches('"').to_string(); let os = read_field(sh, "/etc/os-release", "PRETTY_NAME=")?.trim_matches('"').to_owned();
let cpu = read_field(sh, "/proc/cpuinfo", "model name")? let cpu = read_field(sh, "/proc/cpuinfo", "model name")?
.trim_start_matches(':') .trim_start_matches(':')
.trim() .trim()
.to_string(); .to_owned();
let mem = read_field(sh, "/proc/meminfo", "MemTotal:")?; let mem = read_field(sh, "/proc/meminfo", "MemTotal:")?;
@ -210,7 +210,7 @@ impl Host {
text.lines() text.lines()
.find_map(|it| it.strip_prefix(field)) .find_map(|it| it.strip_prefix(field))
.map(|it| it.trim().to_string()) .map(|it| it.trim().to_owned())
.ok_or_else(|| format_err!("can't parse {}", path)) .ok_or_else(|| format_err!("can't parse {}", path))
} }
} }

View file

@ -183,5 +183,5 @@ fn parse_title_line(s: &str) -> PrInfo {
return PrInfo { message, kind }; return PrInfo { message, kind };
} }
} }
PrInfo { kind: PrKind::Other, message: Some(s.to_string()) } PrInfo { kind: PrKind::Other, message: Some(s.to_owned()) }
} }