mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 05:40:03 -04:00
Increase MSRV to 1.67 (#3234)
* Bump MSRV to 1.67 * clippy fixes * cargo clippy: inline format args * Add `clippy::uninlined_format_args` to cranky lints * Fix clippy on wasm * More clippy fixes
This commit is contained in:
@@ -83,11 +83,11 @@ fn about_immediate_mode(ui: &mut egui::Ui) {
|
||||
fn links(ui: &mut egui::Ui) {
|
||||
use egui::special_emojis::{GITHUB, TWITTER};
|
||||
ui.hyperlink_to(
|
||||
format!("{} egui on GitHub", GITHUB),
|
||||
format!("{GITHUB} egui on GitHub"),
|
||||
"https://github.com/emilk/egui",
|
||||
);
|
||||
ui.hyperlink_to(
|
||||
format!("{} @ernerfeldt", TWITTER),
|
||||
format!("{TWITTER} @ernerfeldt"),
|
||||
"https://twitter.com/ernerfeldt",
|
||||
);
|
||||
ui.hyperlink_to("egui documentation", "https://docs.rs/egui/");
|
||||
|
||||
@@ -121,7 +121,7 @@ impl CodeExample {
|
||||
|
||||
ui.separator();
|
||||
|
||||
code_view_ui(ui, &format!("{:#?}", self));
|
||||
code_view_ui(ui, &format!("{self:#?}"));
|
||||
|
||||
ui.separator();
|
||||
|
||||
|
||||
@@ -251,11 +251,11 @@ impl DemoWindows {
|
||||
|
||||
use egui::special_emojis::{GITHUB, TWITTER};
|
||||
ui.hyperlink_to(
|
||||
format!("{} egui on GitHub", GITHUB),
|
||||
format!("{GITHUB} egui on GitHub"),
|
||||
"https://github.com/emilk/egui",
|
||||
);
|
||||
ui.hyperlink_to(
|
||||
format!("{} @ernerfeldt", TWITTER),
|
||||
format!("{TWITTER} @ernerfeldt"),
|
||||
"https://twitter.com/ernerfeldt",
|
||||
);
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ impl LayoutTest {
|
||||
Direction::TopDown,
|
||||
Direction::BottomUp,
|
||||
] {
|
||||
ui.radio_value(&mut self.layout.main_dir, dir, format!("{:?}", dir));
|
||||
ui.radio_value(&mut self.layout.main_dir, dir, format!("{dir:?}"));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -162,7 +162,7 @@ impl LayoutTest {
|
||||
ui.horizontal(|ui| {
|
||||
ui.label("Cross Align:");
|
||||
for &align in &[Align::Min, Align::Center, Align::Max] {
|
||||
ui.radio_value(&mut self.layout.cross_align, align, format!("{:?}", align));
|
||||
ui.radio_value(&mut self.layout.cross_align, align, format!("{align:?}"));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -455,7 +455,7 @@ impl Tree {
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.filter_map(|(i, mut tree)| {
|
||||
if tree.ui_impl(ui, depth + 1, &format!("child #{}", i)) == Action::Keep {
|
||||
if tree.ui_impl(ui, depth + 1, &format!("child #{i}")) == Action::Keep {
|
||||
Some(tree)
|
||||
} else {
|
||||
None
|
||||
|
||||
@@ -50,7 +50,7 @@ impl super::View for MultiTouch {
|
||||
ui.label("Try touch gestures Pinch/Stretch, Rotation, and Pressure with 2+ fingers.");
|
||||
|
||||
let num_touches = ui.input(|i| i.multi_touch().map_or(0, |mt| mt.num_touches));
|
||||
ui.label(format!("Current touches: {}", num_touches));
|
||||
ui.label(format!("Current touches: {num_touches}"));
|
||||
|
||||
let color = if ui.visuals().dark_mode {
|
||||
Color32::WHITE
|
||||
|
||||
@@ -326,7 +326,7 @@ impl MarkerDemo {
|
||||
[5.0, 0.0 + y_offset],
|
||||
[6.0, 0.5 + y_offset],
|
||||
])
|
||||
.name(format!("{:?}", marker))
|
||||
.name(format!("{marker:?}"))
|
||||
.filled(self.fill_markers)
|
||||
.radius(self.marker_radius)
|
||||
.shape(marker);
|
||||
@@ -416,7 +416,7 @@ impl LegendDemo {
|
||||
ui.label("Position:");
|
||||
ui.horizontal(|ui| {
|
||||
Corner::all().for_each(|position| {
|
||||
ui.selectable_value(&mut config.position, position, format!("{:?}", position));
|
||||
ui.selectable_value(&mut config.position, position, format!("{position:?}"));
|
||||
});
|
||||
});
|
||||
ui.end_row();
|
||||
@@ -774,21 +774,18 @@ impl InteractionDemo {
|
||||
"origin in screen coordinates: x: {:.02}, y: {:.02}",
|
||||
screen_pos.x, screen_pos.y
|
||||
));
|
||||
ui.label(format!("plot hovered: {}", hovered));
|
||||
ui.label(format!("plot hovered: {hovered}"));
|
||||
let coordinate_text = if let Some(coordinate) = pointer_coordinate {
|
||||
format!("x: {:.02}, y: {:.02}", coordinate.x, coordinate.y)
|
||||
} else {
|
||||
"None".to_owned()
|
||||
};
|
||||
ui.label(format!("pointer coordinate: {}", coordinate_text));
|
||||
ui.label(format!("pointer coordinate: {coordinate_text}"));
|
||||
let coordinate_text = format!(
|
||||
"x: {:.02}, y: {:.02}",
|
||||
pointer_coordinate_drag_delta.x, pointer_coordinate_drag_delta.y
|
||||
);
|
||||
ui.label(format!(
|
||||
"pointer coordinate drag delta: {}",
|
||||
coordinate_text
|
||||
));
|
||||
ui.label(format!("pointer coordinate drag delta: {coordinate_text}"));
|
||||
|
||||
response
|
||||
}
|
||||
|
||||
@@ -232,10 +232,10 @@ impl super::View for ScrollTo {
|
||||
for item in 1..=50 {
|
||||
if track_item && item == self.track_item {
|
||||
let response =
|
||||
ui.colored_label(Color32::YELLOW, format!("This is item {}", item));
|
||||
ui.colored_label(Color32::YELLOW, format!("This is item {item}"));
|
||||
response.scroll_to_me(self.tack_item_align);
|
||||
} else {
|
||||
ui.label(format!("This is item {}", item));
|
||||
ui.label(format!("This is item {item}"));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -254,8 +254,7 @@ impl super::View for ScrollTo {
|
||||
ui.separator();
|
||||
|
||||
ui.label(format!(
|
||||
"Scroll offset: {:.0}/{:.0} px",
|
||||
current_scroll, max_scroll
|
||||
"Scroll offset: {current_scroll:.0}/{max_scroll:.0} px"
|
||||
));
|
||||
|
||||
ui.separator();
|
||||
|
||||
@@ -20,7 +20,7 @@ impl super::View for CursorTest {
|
||||
ui.heading("Hover to switch cursor icon:");
|
||||
for &cursor_icon in &egui::CursorIcon::ALL {
|
||||
let _ = ui
|
||||
.button(format!("{:?}", cursor_icon))
|
||||
.button(format!("{cursor_icon:?}"))
|
||||
.on_hover_cursor(cursor_icon);
|
||||
}
|
||||
ui.add(crate::egui_github_link_file!());
|
||||
@@ -239,7 +239,7 @@ impl super::View for TableTest {
|
||||
for row in 0..self.num_rows {
|
||||
for col in 0..self.num_cols {
|
||||
if col == 0 {
|
||||
ui.label(format!("row {}", row));
|
||||
ui.label(format!("row {row}"));
|
||||
} else {
|
||||
let word_idx = row * 3 + col * 5;
|
||||
let word_count = (row * 5 + col * 75) % 13;
|
||||
@@ -350,13 +350,13 @@ impl super::View for InputTest {
|
||||
use std::fmt::Write as _;
|
||||
|
||||
if response.clicked_by(button) {
|
||||
writeln!(new_info, "Clicked by {:?} button", button).ok();
|
||||
writeln!(new_info, "Clicked by {button:?} button").ok();
|
||||
}
|
||||
if response.double_clicked_by(button) {
|
||||
writeln!(new_info, "Double-clicked by {:?} button", button).ok();
|
||||
writeln!(new_info, "Double-clicked by {button:?} button").ok();
|
||||
}
|
||||
if response.triple_clicked_by(button) {
|
||||
writeln!(new_info, "Triple-clicked by {:?} button", button).ok();
|
||||
writeln!(new_info, "Triple-clicked by {button:?} button").ok();
|
||||
}
|
||||
if response.dragged_by(button) {
|
||||
writeln!(
|
||||
|
||||
@@ -126,7 +126,7 @@ impl WidgetGallery {
|
||||
ui.add(doc_link_label("Hyperlink", "Hyperlink"));
|
||||
use egui::special_emojis::GITHUB;
|
||||
ui.hyperlink_to(
|
||||
format!("{} egui on GitHub", GITHUB),
|
||||
format!("{GITHUB} egui on GitHub"),
|
||||
"https://github.com/emilk/egui",
|
||||
);
|
||||
ui.end_row();
|
||||
@@ -173,7 +173,7 @@ impl WidgetGallery {
|
||||
ui.add(doc_link_label("ComboBox", "ComboBox"));
|
||||
|
||||
egui::ComboBox::from_label("Take your pick")
|
||||
.selected_text(format!("{:?}", radio))
|
||||
.selected_text(format!("{radio:?}"))
|
||||
.show_ui(ui, |ui| {
|
||||
ui.style_mut().wrap = Some(false);
|
||||
ui.set_min_width(60.0);
|
||||
@@ -277,8 +277,8 @@ fn example_plot(ui: &mut egui::Ui) -> egui::Response {
|
||||
}
|
||||
|
||||
fn doc_link_label<'a>(title: &'a str, search_term: &'a str) -> impl egui::Widget + 'a {
|
||||
let label = format!("{}:", title);
|
||||
let url = format!("https://docs.rs/egui?search={}", search_term);
|
||||
let label = format!("{title}:");
|
||||
let url = format!("https://docs.rs/egui?search={search_term}");
|
||||
move |ui: &mut egui::Ui| {
|
||||
ui.hyperlink_to(label, url).on_hover_ui(|ui| {
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
|
||||
@@ -161,7 +161,7 @@ fn numbered_point(ui: &mut Ui, width: f32, number: &str) -> Response {
|
||||
let font_id = TextStyle::Body.resolve(ui.style());
|
||||
let row_height = ui.fonts(|f| f.row_height(&font_id));
|
||||
let (rect, response) = ui.allocate_exact_size(vec2(width, row_height), Sense::hover());
|
||||
let text = format!("{}.", number);
|
||||
let text = format!("{number}.");
|
||||
let text_color = ui.visuals().strong_text_color();
|
||||
ui.painter().text(
|
||||
rect.right_center(),
|
||||
|
||||
Reference in New Issue
Block a user