Fix new clippy warnings

This commit is contained in:
Leonard Hecker
2025-04-24 16:16:51 +02:00
parent c0f7a1bfaf
commit c799c347f5
6 changed files with 11 additions and 11 deletions

View File

@@ -31,7 +31,7 @@ impl Error {
pub fn message(&self) -> String {
match *self {
APP_ICU_MISSING => loc(LocId::ErrorIcuMissing).to_string(),
Error::App(code) => format!("Unknown app error code: {}", code),
Error::App(code) => format!("Unknown app error code: {code}"),
Error::Icu(code) => icu::apperr_format(code),
Error::Sys(code) => sys::apperr_format(code),
}

View File

@@ -1046,7 +1046,7 @@ impl TextBuffer {
options: SearchOptions,
) -> apperr::Result<ActiveSearch> {
let sanitized_pattern = if options.whole_word && options.use_regex {
Cow::Owned(format!(r"\b(?:{})\b", pattern))
Cow::Owned(format!(r"\b(?:{pattern})\b"))
} else if options.whole_word {
let mut p = String::with_capacity(pattern.len() + 16);
p.push_str(r"\b");

View File

@@ -57,9 +57,9 @@ pub fn apperr_format(code: u32) -> String {
let msg = format(code);
if !msg.is_empty() {
format!("ICU Error: {}", msg)
format!("ICU Error: {msg}")
} else {
format!("ICU Error: {:#08x}", code)
format!("ICU Error: {code:#08x}")
}
}
@@ -118,7 +118,7 @@ impl<'pivot> Converter<'pivot> {
}
fn append_nul(input: &str) -> String {
format!("{}\0", input)
format!("{input}\0")
}
pub fn convert(

View File

@@ -274,7 +274,7 @@ pub fn read_stdin(mut timeout: time::Duration) -> Option<String> {
STATE.inject_resize = false;
let (w, h) = get_window_size();
if w > 0 && h > 0 {
result = format!("\x1b[8;{};{}t{}", h, w, result);
result = format!("\x1b[8;{h};{w}t{result}");
}
}
@@ -459,7 +459,7 @@ pub fn icu_proc_suffix(handle: NonNull<c_void>) -> String {
let version = &path[suffix_start..];
let version_end = version.find('.').unwrap_or(version.len());
let version = &version[..version_end];
format!("_{}", version)
format!("_{version}")
}
}
@@ -468,7 +468,7 @@ pub fn add_icu_proc_suffix<'a>(name: &'a CStr, suffix: &str) -> Cow<'a, CStr> {
Cow::Borrowed(name)
} else {
let name = unsafe { name.to_str().unwrap_unchecked() };
let combined = format!("{}{}\0", name, suffix);
let combined = format!("{name}{suffix}\0");
let combined = unsafe { CString::from_vec_unchecked(combined.into_bytes()) };
Cow::Owned(combined)
}
@@ -496,7 +496,7 @@ pub fn io_error_to_apperr(err: std::io::Error) -> apperr::Error {
}
pub fn apperr_format(code: u32) -> String {
let mut result = format!("Error {}", code);
let mut result = format!("Error {code}");
unsafe {
let ptr = libc::strerror(code as i32);

View File

@@ -594,7 +594,7 @@ pub fn apperr_format(code: u32) -> String {
null_mut(),
);
let mut result = format!("Error {:#08x}", code);
let mut result = format!("Error {code:#08x}");
if len > 0 {
let msg = helpers::str_from_raw_parts(ptr, len as usize);

View File

@@ -761,7 +761,7 @@ impl Tui {
result.push_str("general:\r\n- focus_path:\r\n");
for &id in self.focused_node_path.iter().rev() {
_ = write!(result, " - {:016x}\r\n", id);
_ = write!(result, " - {id:016x}\r\n");
}
result.push_str("\r\ntree:\r\n");