1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00

Minor clippy fixes (clippy::format_push_string)

This commit is contained in:
Emil Ernerfeldt
2022-07-03 11:58:53 +02:00
parent eeae485629
commit 406703568e
4 changed files with 26 additions and 15 deletions

View File

@@ -52,7 +52,8 @@ impl eframe::App for MyApp {
"???".to_owned()
};
if let Some(bytes) = &file.bytes {
info += &format!(" ({} bytes)", bytes.len());
use std::fmt::Write as _;
write!(info, " ({} bytes)", bytes.len()).ok();
}
ui.label(info);
}
@@ -72,14 +73,15 @@ impl eframe::App for MyApp {
/// Preview hovering files:
fn preview_files_being_dropped(ctx: &egui::Context) {
use egui::*;
use std::fmt::Write as _;
if !ctx.input().raw.hovered_files.is_empty() {
let mut text = "Dropping files:\n".to_owned();
for file in &ctx.input().raw.hovered_files {
if let Some(path) = &file.path {
text += &format!("\n{}", path.display());
write!(text, "\n{}", path.display()).ok();
} else if !file.mime.is_empty() {
text += &format!("\n{}", file.mime);
write!(text, "\n{}", file.mime).ok();
} else {
text += "\n???";
}