mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-01 04:41:14 -03:00
clippy: fix str_to_string lint
https://rust-lang.github.io/rust-clippy/master/index.html#str_to_string Closes #12449
This commit is contained in:
committed by
Johannes Altmanninger
parent
1e3153c3fb
commit
e76370b3b7
@@ -215,6 +215,7 @@ ptr_offset_by_literal = "warn"
|
||||
ref_option = "warn"
|
||||
semicolon_if_nothing_returned = "warn"
|
||||
stable_sort_primitive = "warn"
|
||||
str_to_string = "warn"
|
||||
unnecessary_semicolon = "warn"
|
||||
|
||||
# We do not want to use the e?print(ln)?! macros.
|
||||
|
||||
8
build.rs
8
build.rs
@@ -159,16 +159,14 @@ fn join_if_relative(parent_if_relative: &Path, path: String) -> PathBuf {
|
||||
}
|
||||
|
||||
let prefix = overridable_path("PREFIX", |env_prefix| {
|
||||
Some(PathBuf::from(
|
||||
env_prefix.unwrap_or("/usr/local".to_string()),
|
||||
))
|
||||
Some(PathBuf::from(env_prefix.unwrap_or("/usr/local".to_owned())))
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
overridable_path("SYSCONFDIR", |env_sysconfdir| {
|
||||
Some(join_if_relative(
|
||||
&prefix,
|
||||
env_sysconfdir.unwrap_or("/etc/".to_string()),
|
||||
env_sysconfdir.unwrap_or("/etc/".to_owned()),
|
||||
))
|
||||
});
|
||||
|
||||
@@ -199,5 +197,5 @@ fn get_version() -> String {
|
||||
)
|
||||
.unwrap()
|
||||
.trim_ascii_end()
|
||||
.to_string()
|
||||
.to_owned()
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ fn build_man(sec1_dir: &Path) {
|
||||
];
|
||||
|
||||
rsconf::rebuild_if_env_changed("FISH_BUILD_DOCS");
|
||||
if env_var("FISH_BUILD_DOCS") == Some("0".to_string()) {
|
||||
if env_var("FISH_BUILD_DOCS") == Some("0".to_owned()) {
|
||||
rsconf::warn!("Skipping man pages because $FISH_BUILD_DOCS is set to 0");
|
||||
return;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ fn build_man(sec1_dir: &Path) {
|
||||
Err(e) if e.kind() == std::io::ErrorKind::NotFound => {
|
||||
assert_ne!(
|
||||
env_var("FISH_BUILD_DOCS"),
|
||||
Some("1".to_string()),
|
||||
Some("1".to_owned()),
|
||||
"Could not find sphinx-build required to build man pages.\n\
|
||||
Install Sphinx or disable building the docs by setting $FISH_BUILD_DOCS=0."
|
||||
);
|
||||
|
||||
@@ -43,7 +43,7 @@ fn cpu_use(j: &Job) -> f64 {
|
||||
fn builtin_jobs_print(j: &Job, mode: JobsPrintMode, header: bool, streams: &mut IoStreams) {
|
||||
let pgid = match j.get_pgid() {
|
||||
Some(pgid) => pgid.to_string(),
|
||||
None => "-".to_string(),
|
||||
None => "-".to_owned(),
|
||||
};
|
||||
|
||||
let mut out = WString::new();
|
||||
|
||||
@@ -380,7 +380,7 @@ pub fn get_desc(parser: &Parser, evt: &Event) -> WString {
|
||||
format!("signal handler for {} ({})", signal.name(), signal.desc(),)
|
||||
}
|
||||
EventDescription::Variable { name } => format!("handler for variable '{name}'"),
|
||||
EventDescription::ProcessExit { pid: None } => "exit handler for any process".to_string(),
|
||||
EventDescription::ProcessExit { pid: None } => "exit handler for any process".to_owned(),
|
||||
EventDescription::ProcessExit { pid: Some(pid) } => {
|
||||
format!("exit handler for process {pid}")
|
||||
}
|
||||
@@ -392,11 +392,11 @@ pub fn get_desc(parser: &Parser, evt: &Event) -> WString {
|
||||
format!("exit handler for job with pid {pid}")
|
||||
}
|
||||
} else {
|
||||
"exit handler for any job".to_string()
|
||||
"exit handler for any job".to_owned()
|
||||
}
|
||||
}
|
||||
EventDescription::CallerExit { .. } => {
|
||||
"exit handler for command substitution caller".to_string()
|
||||
"exit handler for command substitution caller".to_owned()
|
||||
}
|
||||
EventDescription::Generic { param } => format!("handler for generic event '{param}'"),
|
||||
EventDescription::Any => unreachable!(),
|
||||
|
||||
@@ -16,7 +16,7 @@ pub unsafe fn set_libc_locales(log_ok: bool) -> bool {
|
||||
if log_ok {
|
||||
crate::flog::flog!(env_locale, {
|
||||
let source = if value == from_environment {
|
||||
"from environment".to_string()
|
||||
"from environment".to_owned()
|
||||
} else {
|
||||
format!("to '{}'", value.to_str().unwrap())
|
||||
};
|
||||
|
||||
@@ -1465,7 +1465,7 @@ fn summary_command(j: &Job, p: Option<&Process>) -> WString {
|
||||
if j.external_procs().count() > 1 {
|
||||
// I don't think it's safe to blindly unwrap here because even though we exited with
|
||||
// a signal, the job could have contained a fish function?
|
||||
let pid = p.pid().map_or("-".to_string(), |p| p.to_string());
|
||||
let pid = p.pid().map_or("-".to_owned(), |p| p.to_string());
|
||||
buffer += &sprintf!(" %s", pid)[..];
|
||||
|
||||
buffer.push(' ');
|
||||
|
||||
@@ -583,7 +583,7 @@ pub fn set_position_in_viewport(&mut self, whence: &str, viewport_y: Option<usiz
|
||||
flogf!(
|
||||
reader,
|
||||
"Setting screen y to %s due to %s",
|
||||
viewport_y.map_or("<none>".to_string(), |y| format!("{y}")),
|
||||
viewport_y.map_or("<none>".to_owned(), |y| format!("{y}")),
|
||||
whence,
|
||||
);
|
||||
self.viewport_y = viewport_y;
|
||||
|
||||
Reference in New Issue
Block a user