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:
parent
bdeae9e959
commit
08fb447fb5
|
|
@ -19,7 +19,7 @@ jobs:
|
|||
|
||||
- uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: 1.65.0
|
||||
toolchain: 1.67.0
|
||||
|
||||
- name: Install packages (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
|
|
@ -87,7 +87,7 @@ jobs:
|
|||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: 1.65.0
|
||||
toolchain: 1.67.0
|
||||
targets: wasm32-unknown-unknown
|
||||
|
||||
- run: sudo apt-get update && sudo apt-get install libgtk-3-dev
|
||||
|
|
@ -145,7 +145,7 @@ jobs:
|
|||
- uses: actions/checkout@v3
|
||||
- uses: EmbarkStudios/cargo-deny-action@v1
|
||||
with:
|
||||
rust-version: "1.65.0"
|
||||
rust-version: "1.67.0"
|
||||
log-level: error
|
||||
command: check
|
||||
arguments: --target ${{ matrix.target }}
|
||||
|
|
@ -160,7 +160,7 @@ jobs:
|
|||
|
||||
- uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: 1.65.0
|
||||
toolchain: 1.67.0
|
||||
targets: aarch64-linux-android
|
||||
|
||||
- name: Set up cargo cache
|
||||
|
|
@ -178,7 +178,7 @@ jobs:
|
|||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: 1.65.0
|
||||
toolchain: 1.67.0
|
||||
|
||||
- name: Set up cargo cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ warn = [
|
|||
"clippy::trailing_empty_array",
|
||||
"clippy::trait_duplication_in_bounds",
|
||||
"clippy::unimplemented",
|
||||
"clippy::uninlined_format_args",
|
||||
"clippy::unnecessary_wraps",
|
||||
"clippy::unnested_or_patterns",
|
||||
"clippy::unused_peekable",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# There is also a scripts/clippy_wasm/clippy.toml which forbids some mthods that are not available in wasm.
|
||||
|
||||
msrv = "1.65"
|
||||
msrv = "1.67"
|
||||
|
||||
# Allow-list of words for markdown in dosctrings https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
|
||||
doc-valid-idents = [
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ authors = [
|
|||
]
|
||||
description = "Color structs and color conversion utilities"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
homepage = "https://github.com/emilk/egui"
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "README.md"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.22.0"
|
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
||||
description = "egui framework - write GUI apps that compiles to web and/or natively"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
homepage = "https://github.com/emilk/egui/tree/master/crates/eframe"
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "README.md"
|
||||
|
|
|
|||
|
|
@ -708,7 +708,7 @@ mod glow_integration {
|
|||
|
||||
let painter =
|
||||
egui_glow::Painter::new(gl.clone(), "", self.native_options.shader_version)
|
||||
.unwrap_or_else(|error| panic!("some OpenGL error occurred {}\n", error));
|
||||
.unwrap_or_else(|err| panic!("An OpenGL error occurred: {err}\n"));
|
||||
|
||||
let system_theme = system_theme(gl_window.window(), &self.native_options);
|
||||
let mut integration = epi_integration::EpiIntegration::new(
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ pub fn canvas_element(canvas_id: &str) -> Option<web_sys::HtmlCanvasElement> {
|
|||
|
||||
pub fn canvas_element_or_die(canvas_id: &str) -> web_sys::HtmlCanvasElement {
|
||||
canvas_element(canvas_id)
|
||||
.unwrap_or_else(|| panic!("Failed to find canvas with id {:?}", canvas_id))
|
||||
.unwrap_or_else(|| panic!("Failed to find canvas with id {canvas_id:?}"))
|
||||
}
|
||||
|
||||
fn canvas_origin(canvas_id: &str) -> egui::Pos2 {
|
||||
|
|
|
|||
|
|
@ -104,8 +104,7 @@ pub fn install_text_agent(runner_ref: &WebRunner) -> Result<(), JsValue> {
|
|||
runner_ref.add_event_listener(&input, "focusout", move |_event: web_sys::MouseEvent, _| {
|
||||
// Delay 10 ms, and focus again.
|
||||
let func = js_sys::Function::new_no_args(&format!(
|
||||
"document.getElementById('{}').focus()",
|
||||
AGENT_ID
|
||||
"document.getElementById('{AGENT_ID}').focus()"
|
||||
));
|
||||
window
|
||||
.set_timeout_with_callback_and_timeout_and_arguments_0(&func, 10)
|
||||
|
|
@ -221,8 +220,8 @@ pub fn move_text_cursor(cursor: Option<egui::Pos2>, canvas_id: &str) -> Option<(
|
|||
let x = (x - canvas.offset_width() as f32 / 2.0)
|
||||
.min(canvas.client_width() as f32 - bounding_rect.width() as f32);
|
||||
style.set_property("position", "absolute").ok()?;
|
||||
style.set_property("top", &format!("{}px", y)).ok()?;
|
||||
style.set_property("left", &format!("{}px", x)).ok()
|
||||
style.set_property("top", &format!("{y}px")).ok()?;
|
||||
style.set_property("left", &format!("{x}px")).ok()
|
||||
})
|
||||
} else {
|
||||
style.set_property("position", "absolute").ok()?;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ impl WebPainterGlow {
|
|||
let gl = std::sync::Arc::new(gl);
|
||||
|
||||
let painter = egui_glow::Painter::new(gl, shader_prefix, None)
|
||||
.map_err(|error| format!("Error starting glow painter: {}", error))?;
|
||||
.map_err(|err| format!("Error starting glow painter: {err}"))?;
|
||||
|
||||
Ok(Self {
|
||||
canvas,
|
||||
|
|
|
|||
|
|
@ -87,8 +87,7 @@ impl WebPainterWgpu {
|
|||
} else {
|
||||
// Workaround for https://github.com/gfx-rs/wgpu/issues/3710:
|
||||
// Don't use `create_surface_from_canvas`, but `create_surface` instead!
|
||||
let raw_window =
|
||||
EguiWebWindow(egui::util::hash(&format!("egui on wgpu {canvas_id}")) as u32);
|
||||
let raw_window = EguiWebWindow(egui::util::hash(("egui on wgpu", canvas_id)) as u32);
|
||||
canvas.set_attribute("data-raw-handle", &raw_window.0.to_string());
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ authors = [
|
|||
"Emil Ernerfeldt <emil.ernerfeldt@gmail.com>",
|
||||
]
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
homepage = "https://github.com/emilk/egui/tree/master/crates/egui-wgpu"
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "README.md"
|
||||
|
|
|
|||
|
|
@ -560,7 +560,7 @@ impl Renderer {
|
|||
} else {
|
||||
// allocate a new texture
|
||||
// Use same label for all resources associated with this texture id (no point in retyping the type)
|
||||
let label_str = format!("egui_texid_{:?}", id);
|
||||
let label_str = format!("egui_texid_{id:?}");
|
||||
let label = Some(label_str.as_str());
|
||||
let texture = device.create_texture(&wgpu::TextureDescriptor {
|
||||
label,
|
||||
|
|
@ -904,8 +904,7 @@ fn create_sampler(
|
|||
};
|
||||
device.create_sampler(&wgpu::SamplerDescriptor {
|
||||
label: Some(&format!(
|
||||
"egui sampler (mag: {:?}, min {:?})",
|
||||
mag_filter, min_filter
|
||||
"egui sampler (mag: {mag_filter:?}, min {min_filter:?})"
|
||||
)),
|
||||
mag_filter,
|
||||
min_filter,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.22.0"
|
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
||||
description = "Bindings for using egui with winit"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
homepage = "https://github.com/emilk/egui/tree/master/crates/egui-winit"
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "README.md"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.22.0"
|
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
||||
description = "An easy-to-use immediate mode GUI that runs on both web and native"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
homepage = "https://github.com/emilk/egui"
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "../../README.md"
|
||||
|
|
|
|||
|
|
@ -566,7 +566,7 @@ impl Context {
|
|||
}
|
||||
|
||||
let show_error = |widget_rect: Rect, text: String| {
|
||||
let text = format!("🔥 {}", text);
|
||||
let text = format!("🔥 {text}");
|
||||
let color = self.style().visuals.error_fg_color;
|
||||
let painter = self.debug_painter();
|
||||
painter.rect_stroke(widget_rect, 0.0, (1.0, color));
|
||||
|
|
@ -612,10 +612,10 @@ impl Context {
|
|||
let id_str = id.short_debug_format();
|
||||
|
||||
if prev_rect.min.distance(new_rect.min) < 4.0 {
|
||||
show_error(new_rect, format!("Double use of {} ID {}", what, id_str));
|
||||
show_error(new_rect, format!("Double use of {what} ID {id_str}"));
|
||||
} else {
|
||||
show_error(prev_rect, format!("First use of {} ID {}", what, id_str));
|
||||
show_error(new_rect, format!("Second use of {} ID {}", what, id_str));
|
||||
show_error(prev_rect, format!("First use of {what} ID {id_str}"));
|
||||
show_error(new_rect, format!("Second use of {what} ID {id_str}"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1574,14 +1574,14 @@ impl Context {
|
|||
|
||||
let pointer_pos = self
|
||||
.pointer_hover_pos()
|
||||
.map_or_else(String::new, |pos| format!("{:?}", pos));
|
||||
ui.label(format!("Pointer pos: {}", pointer_pos));
|
||||
.map_or_else(String::new, |pos| format!("{pos:?}"));
|
||||
ui.label(format!("Pointer pos: {pointer_pos}"));
|
||||
|
||||
let top_layer = self
|
||||
.pointer_hover_pos()
|
||||
.and_then(|pos| self.layer_id_at(pos))
|
||||
.map_or_else(String::new, |layer| layer.short_debug_format());
|
||||
ui.label(format!("Top layer under mouse: {}", top_layer));
|
||||
ui.label(format!("Top layer under mouse: {top_layer}"));
|
||||
|
||||
ui.add_space(16.0);
|
||||
|
||||
|
|
@ -1667,7 +1667,7 @@ impl Context {
|
|||
ui.image(texture_id, size);
|
||||
});
|
||||
|
||||
ui.label(format!("{} x {}", w, h));
|
||||
ui.label(format!("{w} x {h}"));
|
||||
ui.label(format!("{:.3} MB", meta.bytes_used() as f64 * 1e-6));
|
||||
ui.label(format!("{:?}", meta.name));
|
||||
ui.end_row();
|
||||
|
|
@ -1688,8 +1688,7 @@ impl Context {
|
|||
|
||||
let (num_state, num_serialized) = self.data(|d| (d.len(), d.count_serialized()));
|
||||
ui.label(format!(
|
||||
"{} widget states stored (of which {} are serialized).",
|
||||
num_state, num_serialized
|
||||
"{num_state} widget states stored (of which {num_serialized} are serialized)."
|
||||
));
|
||||
|
||||
ui.horizontal(|ui| {
|
||||
|
|
|
|||
|
|
@ -937,25 +937,25 @@ impl RawInput {
|
|||
focused,
|
||||
} = self;
|
||||
|
||||
ui.label(format!("screen_rect: {:?} points", screen_rect));
|
||||
ui.label(format!("pixels_per_point: {:?}", pixels_per_point))
|
||||
ui.label(format!("screen_rect: {screen_rect:?} points"));
|
||||
ui.label(format!("pixels_per_point: {pixels_per_point:?}"))
|
||||
.on_hover_text(
|
||||
"Also called HDPI factor.\nNumber of physical pixels per each logical pixel.",
|
||||
);
|
||||
ui.label(format!("max_texture_side: {:?}", max_texture_side));
|
||||
ui.label(format!("max_texture_side: {max_texture_side:?}"));
|
||||
if let Some(time) = time {
|
||||
ui.label(format!("time: {:.3} s", time));
|
||||
ui.label(format!("time: {time:.3} s"));
|
||||
} else {
|
||||
ui.label("time: None");
|
||||
}
|
||||
ui.label(format!("predicted_dt: {:.1} ms", 1e3 * predicted_dt));
|
||||
ui.label(format!("modifiers: {:#?}", modifiers));
|
||||
ui.label(format!("modifiers: {modifiers:#?}"));
|
||||
ui.label(format!("hovered_files: {}", hovered_files.len()));
|
||||
ui.label(format!("dropped_files: {}", dropped_files.len()));
|
||||
ui.label(format!("focused: {}", focused));
|
||||
ui.label(format!("focused: {focused}"));
|
||||
ui.scope(|ui| {
|
||||
ui.set_min_height(150.0);
|
||||
ui.label(format!("events: {:#?}", events))
|
||||
ui.label(format!("events: {events:#?}"))
|
||||
.on_hover_text("key presses etc");
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ impl PlatformOutput {
|
|||
/// This can be used by a text-to-speech system to describe the events (if any).
|
||||
pub fn events_description(&self) -> String {
|
||||
// only describe last event:
|
||||
if let Some(event) = self.events.iter().rev().next() {
|
||||
if let Some(event) = self.events.iter().next_back() {
|
||||
match event {
|
||||
OutputEvent::Clicked(widget_info)
|
||||
| OutputEvent::DoubleClicked(widget_info)
|
||||
|
|
@ -417,12 +417,12 @@ impl OutputEvent {
|
|||
impl std::fmt::Debug for OutputEvent {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::Clicked(wi) => write!(f, "Clicked({:?})", wi),
|
||||
Self::DoubleClicked(wi) => write!(f, "DoubleClicked({:?})", wi),
|
||||
Self::TripleClicked(wi) => write!(f, "TripleClicked({:?})", wi),
|
||||
Self::FocusGained(wi) => write!(f, "FocusGained({:?})", wi),
|
||||
Self::TextSelectionChanged(wi) => write!(f, "TextSelectionChanged({:?})", wi),
|
||||
Self::ValueChanged(wi) => write!(f, "ValueChanged({:?})", wi),
|
||||
Self::Clicked(wi) => write!(f, "Clicked({wi:?})"),
|
||||
Self::DoubleClicked(wi) => write!(f, "DoubleClicked({wi:?})"),
|
||||
Self::TripleClicked(wi) => write!(f, "TripleClicked({wi:?})"),
|
||||
Self::FocusGained(wi) => write!(f, "FocusGained({wi:?})"),
|
||||
Self::TextSelectionChanged(wi) => write!(f, "TextSelectionChanged({wi:?})"),
|
||||
Self::ValueChanged(wi) => write!(f, "ValueChanged({wi:?})"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -609,14 +609,14 @@ impl WidgetInfo {
|
|||
if let Some(selected) = selected {
|
||||
if *typ == WidgetType::Checkbox {
|
||||
let state = if *selected { "checked" } else { "unchecked" };
|
||||
description = format!("{} {}", state, description);
|
||||
description = format!("{state} {description}");
|
||||
} else {
|
||||
description += if *selected { "selected" } else { "" };
|
||||
};
|
||||
}
|
||||
|
||||
if let Some(label) = label {
|
||||
description = format!("{}: {}", label, description);
|
||||
description = format!("{label}: {description}");
|
||||
}
|
||||
|
||||
if typ == &WidgetType::TextEdit {
|
||||
|
|
@ -630,7 +630,7 @@ impl WidgetInfo {
|
|||
} else {
|
||||
text = "blank".into();
|
||||
}
|
||||
description = format!("{}: {}", text, description);
|
||||
description = format!("{text}: {description}");
|
||||
}
|
||||
|
||||
if let Some(value) = value {
|
||||
|
|
|
|||
|
|
@ -990,30 +990,28 @@ impl InputState {
|
|||
});
|
||||
}
|
||||
|
||||
ui.label(format!("scroll_delta: {:?} points", scroll_delta));
|
||||
ui.label(format!("zoom_factor_delta: {:4.2}x", zoom_factor_delta));
|
||||
ui.label(format!("screen_rect: {:?} points", screen_rect));
|
||||
ui.label(format!("scroll_delta: {scroll_delta:?} points"));
|
||||
ui.label(format!("zoom_factor_delta: {zoom_factor_delta:4.2}x"));
|
||||
ui.label(format!("screen_rect: {screen_rect:?} points"));
|
||||
ui.label(format!(
|
||||
"{} physical pixels for each logical point",
|
||||
pixels_per_point
|
||||
"{pixels_per_point} physical pixels for each logical point"
|
||||
));
|
||||
ui.label(format!(
|
||||
"max texture size (on each side): {}",
|
||||
max_texture_side
|
||||
"max texture size (on each side): {max_texture_side}"
|
||||
));
|
||||
ui.label(format!("time: {:.3} s", time));
|
||||
ui.label(format!("time: {time:.3} s"));
|
||||
ui.label(format!(
|
||||
"time since previous frame: {:.1} ms",
|
||||
1e3 * unstable_dt
|
||||
));
|
||||
ui.label(format!("predicted_dt: {:.1} ms", 1e3 * predicted_dt));
|
||||
ui.label(format!("stable_dt: {:.1} ms", 1e3 * stable_dt));
|
||||
ui.label(format!("focused: {}", focused));
|
||||
ui.label(format!("modifiers: {:#?}", modifiers));
|
||||
ui.label(format!("keys_down: {:?}", keys_down));
|
||||
ui.label(format!("focused: {focused}"));
|
||||
ui.label(format!("modifiers: {modifiers:#?}"));
|
||||
ui.label(format!("keys_down: {keys_down:?}"));
|
||||
ui.scope(|ui| {
|
||||
ui.set_min_height(150.0);
|
||||
ui.label(format!("events: {:#?}", events))
|
||||
ui.label(format!("events: {events:#?}"))
|
||||
.on_hover_text("key presses etc");
|
||||
});
|
||||
}
|
||||
|
|
@ -1037,22 +1035,21 @@ impl PointerState {
|
|||
pointer_events,
|
||||
} = self;
|
||||
|
||||
ui.label(format!("latest_pos: {:?}", latest_pos));
|
||||
ui.label(format!("interact_pos: {:?}", interact_pos));
|
||||
ui.label(format!("delta: {:?}", delta));
|
||||
ui.label(format!("latest_pos: {latest_pos:?}"));
|
||||
ui.label(format!("interact_pos: {interact_pos:?}"));
|
||||
ui.label(format!("delta: {delta:?}"));
|
||||
ui.label(format!(
|
||||
"velocity: [{:3.0} {:3.0}] points/sec",
|
||||
velocity.x, velocity.y
|
||||
));
|
||||
ui.label(format!("down: {:#?}", down));
|
||||
ui.label(format!("press_origin: {:?}", press_origin));
|
||||
ui.label(format!("press_start_time: {:?} s", press_start_time));
|
||||
ui.label(format!("down: {down:#?}"));
|
||||
ui.label(format!("press_origin: {press_origin:?}"));
|
||||
ui.label(format!("press_start_time: {press_start_time:?} s"));
|
||||
ui.label(format!(
|
||||
"has_moved_too_much_for_a_click: {}",
|
||||
has_moved_too_much_for_a_click
|
||||
"has_moved_too_much_for_a_click: {has_moved_too_much_for_a_click}"
|
||||
));
|
||||
ui.label(format!("last_click_time: {:#?}", last_click_time));
|
||||
ui.label(format!("last_last_click_time: {:#?}", last_last_click_time));
|
||||
ui.label(format!("pointer_events: {:?}", pointer_events));
|
||||
ui.label(format!("last_click_time: {last_click_time:#?}"));
|
||||
ui.label(format!("last_last_click_time: {last_last_click_time:#?}"));
|
||||
ui.label(format!("pointer_events: {pointer_events:?}"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ impl TouchState {
|
|||
|
||||
impl TouchState {
|
||||
pub fn ui(&self, ui: &mut crate::Ui) {
|
||||
ui.label(format!("{:?}", self));
|
||||
ui.label(format!("{self:?}"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -294,7 +294,7 @@ impl Debug for TouchState {
|
|||
// This outputs less clutter than `#[derive(Debug)]`:
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
for (id, touch) in &self.active_touches {
|
||||
f.write_fmt(format_args!("#{:?}: {:#?}\n", id, touch))?;
|
||||
f.write_fmt(format_args!("#{id:?}: {touch:#?}\n"))?;
|
||||
}
|
||||
f.write_fmt(format_args!("gesture: {:#?}\n", self.gesture_state))?;
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -31,10 +31,7 @@ pub(crate) fn font_texture_ui(ui: &mut Ui, [width, height]: [usize; 2]) -> Respo
|
|||
Color32::BLACK
|
||||
};
|
||||
|
||||
ui.label(format!(
|
||||
"Texture size: {} x {} (hover to zoom)",
|
||||
width, height
|
||||
));
|
||||
ui.label(format!("Texture size: {width} x {height} (hover to zoom)"));
|
||||
if width <= 1 || height <= 1 {
|
||||
return;
|
||||
}
|
||||
|
|
@ -108,7 +105,7 @@ impl Widget for &epaint::stats::PaintStats {
|
|||
label(ui, shape_path, "paths");
|
||||
label(ui, shape_mesh, "nested meshes");
|
||||
label(ui, shape_vec, "nested shapes");
|
||||
ui.label(format!("{:6} callbacks", num_callbacks));
|
||||
ui.label(format!("{num_callbacks:6} callbacks"));
|
||||
ui.add_space(10.0);
|
||||
|
||||
ui.label("Text shapes:");
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ impl Painter {
|
|||
|
||||
pub fn error(&self, pos: Pos2, text: impl std::fmt::Display) -> Rect {
|
||||
let color = self.ctx.style().visuals.error_fg_color;
|
||||
self.debug_text(pos, Align2::LEFT_TOP, color, format!("🔥 {}", text))
|
||||
self.debug_text(pos, Align2::LEFT_TOP, color, format!("🔥 {text}"))
|
||||
}
|
||||
|
||||
/// text with a background
|
||||
|
|
|
|||
|
|
@ -234,17 +234,17 @@ fn color_text_ui(ui: &mut Ui, color: impl Into<Color32>, alpha: Alpha) {
|
|||
|
||||
if ui.button("📋").on_hover_text("Click to copy").clicked() {
|
||||
if alpha == Alpha::Opaque {
|
||||
ui.output_mut(|o| o.copied_text = format!("{}, {}, {}", r, g, b));
|
||||
ui.output_mut(|o| o.copied_text = format!("{r}, {g}, {b}"));
|
||||
} else {
|
||||
ui.output_mut(|o| o.copied_text = format!("{}, {}, {}, {}", r, g, b, a));
|
||||
ui.output_mut(|o| o.copied_text = format!("{r}, {g}, {b}, {a}"));
|
||||
}
|
||||
}
|
||||
|
||||
if alpha == Alpha::Opaque {
|
||||
ui.label(format!("rgb({}, {}, {})", r, g, b))
|
||||
ui.label(format!("rgb({r}, {g}, {b})"))
|
||||
.on_hover_text("Red Green Blue");
|
||||
} else {
|
||||
ui.label(format!("rgba({}, {}, {}, {})", r, g, b, a))
|
||||
ui.label(format!("rgba({r}, {g}, {b}, {a})"))
|
||||
.on_hover_text("Red Green Blue with premultiplied Alpha");
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -627,7 +627,7 @@ impl<'a> Widget for DragValue<'a> {
|
|||
// The value is exposed as a string by the text edit widget
|
||||
// when in edit mode.
|
||||
if !is_kb_editing {
|
||||
let value_text = format!("{}{}{}", prefix, value_text, suffix);
|
||||
let value_text = format!("{prefix}{value_text}{suffix}");
|
||||
builder.set_value(value_text);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1732,7 +1732,7 @@ pub(super) fn rulers_at_value(
|
|||
let mut prefix = String::new();
|
||||
|
||||
if !name.is_empty() {
|
||||
prefix = format!("{}\n", name);
|
||||
prefix = format!("{name}\n");
|
||||
}
|
||||
|
||||
let text = {
|
||||
|
|
|
|||
|
|
@ -125,8 +125,8 @@ impl ToString for LineStyle {
|
|||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
LineStyle::Solid => "Solid".into(),
|
||||
LineStyle::Dotted { spacing } => format!("Dotted{}Px", spacing),
|
||||
LineStyle::Dashed { length } => format!("Dashed{}Px", length),
|
||||
LineStyle::Dotted { spacing } => format!("Dotted{spacing}Px"),
|
||||
LineStyle::Dashed { length } => format!("Dashed{length}Px"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1453,7 +1453,7 @@ impl PreparedPlot {
|
|||
let axis_range = match axis {
|
||||
0 => bounds.range_x(),
|
||||
1 => bounds.range_y(),
|
||||
_ => panic!("Axis {} does not exist.", axis),
|
||||
_ => panic!("Axis {axis} does not exist."),
|
||||
};
|
||||
|
||||
let font_id = TextStyle::Body.resolve(ui.style());
|
||||
|
|
@ -1676,7 +1676,7 @@ pub fn format_number(number: f64, num_decimals: usize) -> String {
|
|||
let is_integral = number as i64 as f64 == number;
|
||||
if is_integral {
|
||||
// perfect integer - show it as such:
|
||||
format!("{:.0}", number)
|
||||
format!("{number:.0}")
|
||||
} else {
|
||||
// make sure we tell the user it is not an integer by always showing a decimal or two:
|
||||
format!("{:.*}", num_decimals.at_least(1), number)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.22.0"
|
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
publish = false
|
||||
default-run = "egui_demo_app"
|
||||
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ fn ui_url(ui: &mut egui::Ui, frame: &mut eframe::Frame, url: &mut String) -> boo
|
|||
if ui.button("Random image").clicked() {
|
||||
let seed = ui.input(|i| i.time);
|
||||
let side = 640;
|
||||
*url = format!("https://picsum.photos/seed/{}/{}", seed, side);
|
||||
*url = format!("https://picsum.photos/seed/{seed}/{side}");
|
||||
trigger_fetch = true;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -232,8 +232,7 @@ impl BackendPanel {
|
|||
if ui
|
||||
.add_enabled(enabled, egui::Button::new("Reset"))
|
||||
.on_hover_text(format!(
|
||||
"Reset scale to native value ({:.1})",
|
||||
native_pixels_per_point
|
||||
"Reset scale to native value ({native_pixels_per_point:.1})"
|
||||
))
|
||||
.clicked()
|
||||
{
|
||||
|
|
@ -441,7 +440,7 @@ impl EguiWindows {
|
|||
.stick_to_bottom(true)
|
||||
.show(ui, |ui| {
|
||||
for event in output_event_history {
|
||||
ui.label(format!("{:?}", event));
|
||||
ui.label(format!("{event:?}"));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ impl WrapApp {
|
|||
{
|
||||
selected_anchor = anchor;
|
||||
if frame.is_web() {
|
||||
ui.output_mut(|o| o.open_url(format!("#{}", anchor)));
|
||||
ui.output_mut(|o| o.open_url(format!("#{anchor}")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.22.0"
|
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
||||
description = "Example library for egui"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
homepage = "https://github.com/emilk/egui/tree/master/crates/egui_demo_lib"
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "README.md"
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ authors = [
|
|||
]
|
||||
description = "Extra functionality and widgets for the egui GUI library"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
homepage = "https://github.com/emilk/egui"
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "README.md"
|
||||
|
|
|
|||
|
|
@ -428,6 +428,6 @@ fn month_name(i: u32) -> &'static str {
|
|||
10 => "October",
|
||||
11 => "November",
|
||||
12 => "December",
|
||||
_ => panic!("Unknown month: {}", i),
|
||||
_ => panic!("Unknown month: {i}"),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ pub fn load_svg_bytes_with_size(
|
|||
};
|
||||
|
||||
let mut pixmap = tiny_skia::Pixmap::new(w, h)
|
||||
.ok_or_else(|| format!("Failed to create SVG Pixmap of size {}x{}", w, h))?;
|
||||
.ok_or_else(|| format!("Failed to create SVG Pixmap of size {w}x{h}"))?;
|
||||
|
||||
resvg::render(&rtree, fit_to, Default::default(), pixmap.as_mut())
|
||||
.ok_or_else(|| "Failed to render SVG".to_owned())?;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.22.0"
|
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
||||
description = "Bindings for using egui natively using the glium library"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
homepage = "https://github.com/emilk/egui/tree/master/crates/egui_glium"
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "README.md"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.22.0"
|
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
||||
description = "Bindings for using egui natively using the glow library"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
homepage = "https://github.com/emilk/egui/tree/master/crates/egui_glow"
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "README.md"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.22.0"
|
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
||||
description = "Minimal 2D math library for GUI work"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
homepage = "https://github.com/emilk/egui/tree/master/crates/emath"
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "README.md"
|
||||
|
|
|
|||
|
|
@ -183,9 +183,7 @@ where
|
|||
/// Round a value to the given number of decimal places.
|
||||
pub fn round_to_decimals(value: f64, decimal_places: usize) -> f64 {
|
||||
// This is a stupid way of doing this, but stupid works.
|
||||
format!("{:.*}", decimal_places, value)
|
||||
.parse()
|
||||
.unwrap_or(value)
|
||||
format!("{value:.decimal_places$}").parse().unwrap_or(value)
|
||||
}
|
||||
|
||||
pub fn format_with_minimum_decimals(value: f64, decimals: usize) -> String {
|
||||
|
|
@ -203,7 +201,7 @@ pub fn format_with_decimals_in_range(value: f64, decimal_range: RangeInclusive<u
|
|||
if min_decimals != max_decimals {
|
||||
// Ugly/slow way of doing this. TODO(emilk): clean up precision.
|
||||
for decimals in min_decimals..max_decimals {
|
||||
let text = format!("{:.*}", decimals, value);
|
||||
let text = format!("{value:.decimals$}");
|
||||
let epsilon = 16.0 * f32::EPSILON; // margin large enough to handle most peoples round-tripping needs
|
||||
if almost_equal(text.parse::<f32>().unwrap(), value as f32, epsilon) {
|
||||
// Enough precision to show the value accurately - good!
|
||||
|
|
@ -214,7 +212,7 @@ pub fn format_with_decimals_in_range(value: f64, decimal_range: RangeInclusive<u
|
|||
// Probably the value was set not by the slider, but from outside.
|
||||
// In any case: show the full value
|
||||
}
|
||||
format!("{:.*}", max_decimals, value)
|
||||
format!("{value:.max_decimals$}")
|
||||
}
|
||||
|
||||
/// Return true when arguments are the same within some rounding error.
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ impl std::ops::Index<usize> for Pos2 {
|
|||
match index {
|
||||
0 => &self.x,
|
||||
1 => &self.y,
|
||||
_ => panic!("Pos2 index out of bounds: {}", index),
|
||||
_ => panic!("Pos2 index out of bounds: {index}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -217,7 +217,7 @@ impl std::ops::IndexMut<usize> for Pos2 {
|
|||
match index {
|
||||
0 => &mut self.x,
|
||||
1 => &mut self.y,
|
||||
_ => panic!("Pos2 index out of bounds: {}", index),
|
||||
_ => panic!("Pos2 index out of bounds: {index}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,10 +184,7 @@ mod test {
|
|||
let expected = vec2(0.0, 3.0);
|
||||
assert!(
|
||||
(rotated - expected).length() < 1e-5,
|
||||
"Expected {:?} to equal {:?}. rot: {:?}",
|
||||
rotated,
|
||||
expected,
|
||||
rot,
|
||||
"Expected {rotated:?} to equal {expected:?}. rot: {rot:?}",
|
||||
);
|
||||
|
||||
let undone = rot.inverse() * rot;
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ impl std::ops::Index<usize> for Vec2 {
|
|||
match index {
|
||||
0 => &self.x,
|
||||
1 => &self.y,
|
||||
_ => panic!("Vec2 index out of bounds: {}", index),
|
||||
_ => panic!("Vec2 index out of bounds: {index}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -303,7 +303,7 @@ impl std::ops::IndexMut<usize> for Vec2 {
|
|||
match index {
|
||||
0 => &mut self.x,
|
||||
1 => &mut self.y,
|
||||
_ => panic!("Vec2 index out of bounds: {}", index),
|
||||
_ => panic!("Vec2 index out of bounds: {index}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.22.0"
|
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
||||
description = "Minimal 2D graphics library for GUI work"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
homepage = "https://github.com/emilk/egui/tree/master/crates/epaint"
|
||||
license = "(MIT OR Apache-2.0) AND OFL-1.1 AND LicenseRef-UFL-1.0" # OFL and UFL used by default_fonts. See https://github.com/emilk/egui/issues/2321
|
||||
readme = "README.md"
|
||||
|
|
|
|||
|
|
@ -251,8 +251,7 @@ impl Mesh {
|
|||
|
||||
assert!(
|
||||
index_cursor > span_start,
|
||||
"One triangle spanned more than {} vertices",
|
||||
MAX_SIZE
|
||||
"One triangle spanned more than {MAX_SIZE} vertices"
|
||||
);
|
||||
|
||||
let mesh = Mesh16 {
|
||||
|
|
|
|||
|
|
@ -333,7 +333,7 @@ mod rw_lock_impl {
|
|||
fn format_backtrace(backtrace: &mut backtrace::Backtrace) -> String {
|
||||
backtrace.resolve();
|
||||
|
||||
let stacktrace = format!("{:?}", backtrace);
|
||||
let stacktrace = format!("{backtrace:?}");
|
||||
|
||||
// Remove irrelevant parts of the stacktrace:
|
||||
let end_offset = stacktrace
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ impl AllocInfo {
|
|||
element_size: ElementSize::Homogeneous(element_size),
|
||||
num_allocs: 1,
|
||||
num_elements: slice.len(),
|
||||
num_bytes: slice.len() * element_size,
|
||||
num_bytes: std::mem::size_of_val(slice),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -367,8 +367,7 @@ impl Font {
|
|||
.or_else(|| slf.glyph_info_no_cache_or_fallback(FALLBACK_REPLACEMENT_CHAR))
|
||||
.unwrap_or_else(|| {
|
||||
panic!(
|
||||
"Failed to find replacement characters {:?} or {:?}",
|
||||
PRIMARY_REPLACEMENT_CHAR, FALLBACK_REPLACEMENT_CHAR
|
||||
"Failed to find replacement characters {PRIMARY_REPLACEMENT_CHAR:?} or {FALLBACK_REPLACEMENT_CHAR:?}"
|
||||
)
|
||||
});
|
||||
slf.replacement_glyph = replacement_glyph;
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ fn ab_glyph_font_from_font_data(name: &str, data: &FontData) -> ab_glyph::FontAr
|
|||
.map(ab_glyph::FontArc::from)
|
||||
}
|
||||
}
|
||||
.unwrap_or_else(|err| panic!("Error parsing {:?} TTF/OTF font file: {}", name, err))
|
||||
.unwrap_or_else(|err| panic!("Error parsing {name:?} TTF/OTF font file: {err}"))
|
||||
}
|
||||
|
||||
/// Describes the font data and the sizes to use.
|
||||
|
|
@ -586,8 +586,7 @@ impl FontsImpl {
|
|||
) -> Self {
|
||||
assert!(
|
||||
0.0 < pixels_per_point && pixels_per_point < 100.0,
|
||||
"pixels_per_point out of range: {}",
|
||||
pixels_per_point
|
||||
"pixels_per_point out of range: {pixels_per_point}"
|
||||
);
|
||||
|
||||
let texture_width = max_texture_side.at_most(8 * 1024);
|
||||
|
|
@ -627,9 +626,8 @@ impl FontsImpl {
|
|||
.entry((HashableF32(*size), family.clone()))
|
||||
.or_insert_with(|| {
|
||||
let fonts = &self.definitions.families.get(family);
|
||||
let fonts = fonts.unwrap_or_else(|| {
|
||||
panic!("FontFamily::{:?} is not bound to any fonts", family)
|
||||
});
|
||||
let fonts = fonts
|
||||
.unwrap_or_else(|| panic!("FontFamily::{family:?} is not bound to any fonts"));
|
||||
|
||||
let fonts: Vec<Arc<FontImpl>> = fonts
|
||||
.iter()
|
||||
|
|
@ -752,17 +750,14 @@ impl FontImplCache {
|
|||
let (tweak, ab_glyph_font) = self
|
||||
.ab_glyph_fonts
|
||||
.get(font_name)
|
||||
.unwrap_or_else(|| panic!("No font data found for {:?}", font_name))
|
||||
.unwrap_or_else(|| panic!("No font data found for {font_name:?}"))
|
||||
.clone();
|
||||
|
||||
let scale_in_pixels = self.pixels_per_point * scale_in_points;
|
||||
|
||||
// Scale the font properly (see https://github.com/emilk/egui/issues/2068).
|
||||
let units_per_em = ab_glyph_font.units_per_em().unwrap_or_else(|| {
|
||||
panic!(
|
||||
"The font unit size of {:?} exceeds the expected range (16..=16384)",
|
||||
font_name
|
||||
)
|
||||
panic!("The font unit size of {font_name:?} exceeds the expected range (16..=16384)")
|
||||
});
|
||||
let font_scaling = ab_glyph_font.height_unscaled() / units_per_em;
|
||||
let scale_in_pixels = scale_in_pixels * font_scaling;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
publish = false
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
publish = false
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ impl RotatingTriangle {
|
|||
let shader = gl
|
||||
.create_shader(*shader_type)
|
||||
.expect("Cannot create shader");
|
||||
gl.shader_source(shader, &format!("{}\n{}", shader_version, shader_source));
|
||||
gl.shader_source(shader, &format!("{shader_version}\n{shader_source}"));
|
||||
gl.compile_shader(shader);
|
||||
assert!(
|
||||
gl.get_shader_compile_status(shader),
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
publish = false
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||
authors = ["tami5 <kkharji@proton.me>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
publish = false
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
publish = false
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
publish = false
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -58,8 +58,7 @@ fn parse_response(response: ehttp::Response) -> Result<RetainedImage, String> {
|
|||
RetainedImage::from_image_bytes(&response.url, &response.bytes)
|
||||
} else {
|
||||
Err(format!(
|
||||
"Expected image, found content-type {:?}",
|
||||
content_type
|
||||
"Expected image, found content-type {content_type:?}"
|
||||
))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
publish = false
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
publish = false
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||
authors = ["Maxim Osipenko <maxim1999max@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
publish = false
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ fn new_worker(
|
|||
) -> (JoinHandle<()>, mpsc::SyncSender<egui::Context>) {
|
||||
let (show_tx, show_rc) = mpsc::sync_channel(0);
|
||||
let handle = std::thread::Builder::new()
|
||||
.name(format!("EguiPanelWorker {}", thread_nr))
|
||||
.name(format!("EguiPanelWorker {thread_nr}"))
|
||||
.spawn(move || {
|
||||
let mut state = ThreadState::new(thread_nr);
|
||||
while let Ok(ctx) = show_rc.recv() {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
publish = false
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||
authors = ["Jose Palazon <jose@palako.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
publish = false
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
publish = false
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ fn start_puffin_server() {
|
|||
std::mem::forget(puffin_server);
|
||||
}
|
||||
Err(err) => {
|
||||
eprintln!("Failed to start puffin server: {}", err);
|
||||
eprintln!("Failed to start puffin server: {err}");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
publish = false
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||
authors = ["hacknus <l_stoeckli@bluewin.ch>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ fn main() -> Result<(), eframe::Error> {
|
|||
eframe::run_native(
|
||||
"My egui App with a plot",
|
||||
options,
|
||||
Box::new(|_cc| Box::new(MyApp::default())),
|
||||
Box::new(|_cc| Box::<MyApp>::default()),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ authors = [
|
|||
]
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
publish = false
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
publish = false
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
publish = false
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||
authors = ["TicClick <ya@ticclick.ch>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.67"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ fn main() -> eframe::Result<()> {
|
|||
}
|
||||
|
||||
fn repr(attention: UserAttentionType) -> String {
|
||||
format!("{:?}", attention)
|
||||
format!("{attention:?}")
|
||||
}
|
||||
|
||||
struct Application {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@
|
|||
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".
|
||||
|
||||
[toolchain]
|
||||
channel = "1.65.0"
|
||||
channel = "1.67.0"
|
||||
components = [ "rustfmt", "clippy" ]
|
||||
targets = [ "wasm32-unknown-unknown" ]
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
# We cannot forbid all these methods in the main `clippy.toml` because of
|
||||
# https://github.com/rust-lang/rust-clippy/issues/10406
|
||||
|
||||
msrv = "1.65"
|
||||
msrv = "1.67"
|
||||
|
||||
# https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_methods
|
||||
disallowed-methods = [
|
||||
|
|
|
|||
Loading…
Reference in New Issue