clippy fixes

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2025-07-17 13:49:53 -07:00
parent a4c1b38116
commit 8a1398face
26 changed files with 51 additions and 62 deletions

View File

@@ -504,7 +504,7 @@ impl Damus {
pub fn gen_subid(&self, kind: &SubKind) -> String {
if self.options.contains(AppOptions::Debug) {
format!("{:?}", kind)
format!("{kind:?}")
} else {
Uuid::new_v4().to_string()
}

View File

@@ -55,8 +55,7 @@ fn available_characters(ui: &egui::Ui, family: egui::FontFamily) -> Vec<char> {
.fonts
.font(&egui::FontId::new(10.0, family)) // size is arbitrary for getting the characters
.characters()
.iter()
.map(|(chr, _v)| chr)
.keys()
.filter(|chr| !chr.is_whitespace() && !chr.is_ascii_control())
.copied()
.collect()

View File

@@ -270,7 +270,7 @@ impl Decks {
if self.decks.len() > 1 {
self.decks.remove(index);
let info_prefix = format!("Removed deck at index {}", index);
let info_prefix = format!("Removed deck at index {index}");
match index.cmp(&self.active_deck) {
std::cmp::Ordering::Less => {
info!(

View File

@@ -106,7 +106,7 @@ fn create_nip96_request(
)
.into_bytes();
body.extend(file_contents);
body.extend(format!("\r\n--{}--\r\n", boundary).as_bytes());
body.extend(format!("\r\n--{boundary}--\r\n").as_bytes());
let headers = ehttp::Headers::new(&[
(
@@ -246,7 +246,7 @@ impl MediaPath {
let file_name = path
.file_name()
.and_then(|name| name.to_str())
.unwrap_or(&format!("file.{}", ex))
.unwrap_or(&format!("file.{ex}"))
.to_owned();
Ok(MediaPath {
@@ -256,8 +256,7 @@ impl MediaPath {
})
} else {
Err(Error::Generic(format!(
"{:?} does not have an extension",
path
"{path:?} does not have an extension"
)))
}
}

View File

@@ -192,7 +192,7 @@ impl fmt::Display for MetadataKeyword {
.find(|(_, keyword)| keyword == self)
.map(|(name, _)| *name)
{
write!(f, "{}", name)
write!(f, "{name}")
} else {
write!(f, "UnknownMetadataKeyword")
}

View File

@@ -83,8 +83,7 @@ fn get_log_str(interactor: &Directory) -> Option<String> {
fn get_prefix(file_name: &str, lines_displayed: usize, num_total_lines: usize) -> String {
format!(
"===\nDisplaying the last {} of {} lines in file {}\n===\n\n",
lines_displayed, num_total_lines, file_name,
"===\nDisplaying the last {lines_displayed} of {num_total_lines} lines in file {file_name}\n===\n\n",
)
}

View File

@@ -734,7 +734,7 @@ pub fn is_timeline_ready(
let note = ndb.get_note_by_key(&txn, note_key).expect("note");
let add_pk = timeline.kind.pubkey().map(|pk| pk.bytes());
hybrid_contacts_filter(&note, add_pk, with_hashtags).map_err(Into::into)
hybrid_contacts_filter(&note, add_pk, with_hashtags)
};
// TODO: into_follow_filter is hardcoded to contact lists, let's generalize

View File

@@ -679,7 +679,7 @@ pub fn render_add_column_routes(
// TODO: spin off the list search here instead
ui.label(format!("error: could not find {:?}", list_kind));
ui.label(format!("error: could not find {list_kind:?}"));
}
}
},

View File

@@ -139,7 +139,7 @@ fn show_warnings(ui: &mut Ui, warn_no_icon: bool, warn_no_title: bool) {
ui.add(
egui::Label::new(
RichText::new(format!("Please {}.", message)).color(ui.visuals().error_fg_color),
RichText::new(format!("Please {message}.")).color(ui.visuals().error_fg_color),
)
.wrap(),
);

View File

@@ -121,12 +121,9 @@ impl<'a> EditProfileView<'a> {
ui.colored_label(
ui.visuals().noninteractive().fg_stroke.color,
RichText::new(if use_domain {
format!("\"{}\" will be used for identification", suffix)
format!("\"{suffix}\" will be used for identification")
} else {
format!(
"\"{}\" at \"{}\" will be used for identification",
prefix, suffix
)
format!("\"{prefix}\" at \"{suffix}\" will be used for identification")
}),
);
});