Enable more clippy lints (#6853)
* Follows https://github.com/emilk/egui/pull/6848
This commit is contained in:
parent
fdb9aa282a
commit
f9245954eb
10
Cargo.toml
10
Cargo.toml
|
|
@ -134,6 +134,7 @@ broken_intra_doc_links = "warn"
|
|||
|
||||
# See also clippy.toml
|
||||
[workspace.lints.clippy]
|
||||
allow_attributes = "warn"
|
||||
as_ptr_cast_mut = "warn"
|
||||
await_holding_lock = "warn"
|
||||
bool_to_int_with_if = "warn"
|
||||
|
|
@ -195,13 +196,13 @@ macro_use_imports = "warn"
|
|||
manual_assert = "warn"
|
||||
manual_clamp = "warn"
|
||||
manual_instant_elapsed = "warn"
|
||||
manual_is_power_of_two = "warn"
|
||||
manual_is_variant_and = "warn"
|
||||
manual_let_else = "warn"
|
||||
manual_ok_or = "warn"
|
||||
manual_string_new = "warn"
|
||||
map_err_ignore = "warn"
|
||||
map_flatten = "warn"
|
||||
map_unwrap_or = "warn"
|
||||
match_bool = "warn"
|
||||
match_on_vec_items = "warn"
|
||||
match_same_arms = "warn"
|
||||
|
|
@ -222,11 +223,13 @@ needless_for_each = "warn"
|
|||
needless_pass_by_ref_mut = "warn"
|
||||
needless_pass_by_value = "warn"
|
||||
negative_feature_names = "warn"
|
||||
non_zero_suggestions = "warn"
|
||||
nonstandard_macro_braces = "warn"
|
||||
option_as_ref_cloned = "warn"
|
||||
option_option = "warn"
|
||||
path_buf_push_overwrite = "warn"
|
||||
print_stderr = "warn"
|
||||
pathbuf_init_then_push = "warn"
|
||||
ptr_as_ptr = "warn"
|
||||
ptr_cast_constness = "warn"
|
||||
pub_underscore_fields = "warn"
|
||||
|
|
@ -240,6 +243,7 @@ ref_patterns = "warn"
|
|||
rest_pat_in_fully_bound_structs = "warn"
|
||||
same_functions_in_if_condition = "warn"
|
||||
semicolon_if_nothing_returned = "warn"
|
||||
set_contains_or_insert = "warn"
|
||||
single_char_pattern = "warn"
|
||||
single_match_else = "warn"
|
||||
str_split_at_newline = "warn"
|
||||
|
|
@ -252,6 +256,7 @@ string_to_string = "warn"
|
|||
suspicious_command_arg_space = "warn"
|
||||
suspicious_xor_used_as_pow = "warn"
|
||||
todo = "warn"
|
||||
too_long_first_doc_paragraph = "warn"
|
||||
trailing_empty_array = "warn"
|
||||
trait_duplication_in_bounds = "warn"
|
||||
tuple_array_conversions = "warn"
|
||||
|
|
@ -261,6 +266,7 @@ unimplemented = "warn"
|
|||
uninhabited_references = "warn"
|
||||
uninlined_format_args = "warn"
|
||||
unnecessary_box_returns = "warn"
|
||||
unnecessary_literal_bound = "warn"
|
||||
unnecessary_safety_doc = "warn"
|
||||
unnecessary_struct_initialization = "warn"
|
||||
unnecessary_wraps = "warn"
|
||||
|
|
@ -268,6 +274,7 @@ unnested_or_patterns = "warn"
|
|||
unused_peekable = "warn"
|
||||
unused_rounding = "warn"
|
||||
unused_self = "warn"
|
||||
unused_trait_names = "warn"
|
||||
use_self = "warn"
|
||||
useless_transmute = "warn"
|
||||
verbose_file_reads = "warn"
|
||||
|
|
@ -286,6 +293,7 @@ assigning_clones = "allow" # No please
|
|||
let_underscore_must_use = "allow"
|
||||
let_underscore_untyped = "allow"
|
||||
manual_range_contains = "allow" # this one is just worse imho
|
||||
map_unwrap_or = "allow" # so is this one
|
||||
self_named_module_files = "allow" # Disabled waiting on https://github.com/rust-lang/rust-clippy/issues/9602
|
||||
significant_drop_tightening = "allow" # Too many false positives
|
||||
wildcard_imports = "allow" # `use crate::*` is useful to avoid merge conflicts when adding/removing imports
|
||||
|
|
|
|||
|
|
@ -33,12 +33,11 @@ pub(crate) fn f32_hash<H: std::hash::Hasher>(state: &mut H, f: f32) {
|
|||
} else if f.is_nan() {
|
||||
state.write_u8(1);
|
||||
} else {
|
||||
use std::hash::Hash;
|
||||
use std::hash::Hash as _;
|
||||
f.to_bits().hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::derived_hash_with_manual_eq)]
|
||||
impl std::hash::Hash for Rgba {
|
||||
#[inline]
|
||||
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ pub struct CreationContext<'s> {
|
|||
pub(crate) raw_display_handle: Result<RawDisplayHandle, HandleError>,
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
impl HasWindowHandle for CreationContext<'_> {
|
||||
fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError> {
|
||||
|
|
@ -100,7 +100,7 @@ impl HasWindowHandle for CreationContext<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
impl HasDisplayHandle for CreationContext<'_> {
|
||||
fn display_handle(&self) -> Result<DisplayHandle<'_>, HandleError> {
|
||||
|
|
@ -662,7 +662,7 @@ pub struct Frame {
|
|||
#[cfg(not(target_arch = "wasm32"))]
|
||||
assert_not_impl_any!(Frame: Clone);
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
impl HasWindowHandle for Frame {
|
||||
fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError> {
|
||||
|
|
@ -671,7 +671,7 @@ impl HasWindowHandle for Frame {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
impl HasDisplayHandle for Frame {
|
||||
fn display_handle(&self) -> Result<DisplayHandle<'_>, HandleError> {
|
||||
|
|
@ -703,7 +703,7 @@ impl Frame {
|
|||
/// True if you are in a web environment.
|
||||
///
|
||||
/// Equivalent to `cfg!(target_arch = "wasm32")`
|
||||
#[allow(clippy::unused_self)]
|
||||
#[expect(clippy::unused_self)]
|
||||
pub fn is_web(&self) -> bool {
|
||||
cfg!(target_arch = "wasm32")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@
|
|||
//! #[wasm_bindgen]
|
||||
//! impl WebHandle {
|
||||
//! /// Installs a panic hook, then returns.
|
||||
//! #[allow(clippy::new_without_default)]
|
||||
//! #[expect(clippy::new_without_default)]
|
||||
//! #[wasm_bindgen(constructor)]
|
||||
//! pub fn new() -> Self {
|
||||
//! // Redirect [`log`] message to `console.log` and friends:
|
||||
|
|
@ -236,7 +236,7 @@ pub mod icon_data;
|
|||
/// This function can fail if we fail to set up a graphics context.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[cfg(any(feature = "glow", feature = "wgpu"))]
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[allow(clippy::needless_pass_by_value, clippy::allow_attributes)]
|
||||
pub fn run_native(
|
||||
app_name: &str,
|
||||
mut native_options: NativeOptions,
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ enum AppIconStatus {
|
|||
NotSetTryAgain,
|
||||
|
||||
/// We successfully set the icon and it should be visible now.
|
||||
#[allow(dead_code)] // Not used on Linux
|
||||
#[allow(dead_code, clippy::allow_attributes)] // Not used on Linux
|
||||
Set,
|
||||
}
|
||||
|
||||
|
|
@ -71,13 +71,13 @@ fn set_title_and_icon(_title: &str, _icon_data: Option<&IconData>) -> AppIconSta
|
|||
#[cfg(target_os = "macos")]
|
||||
return set_title_and_icon_mac(_title, _icon_data);
|
||||
|
||||
#[allow(unreachable_code)]
|
||||
#[allow(unreachable_code, clippy::allow_attributes)]
|
||||
AppIconStatus::NotSetIgnored
|
||||
}
|
||||
|
||||
/// Set icon for Windows applications.
|
||||
#[cfg(target_os = "windows")]
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
fn set_app_icon_windows(icon_data: &IconData) -> AppIconStatus {
|
||||
use crate::icon_data::IconDataExt as _;
|
||||
use winapi::um::winuser;
|
||||
|
|
@ -198,12 +198,12 @@ fn set_app_icon_windows(icon_data: &IconData) -> AppIconStatus {
|
|||
|
||||
/// Set icon & app title for `MacOS` applications.
|
||||
#[cfg(target_os = "macos")]
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
fn set_title_and_icon_mac(title: &str, icon_data: Option<&IconData>) -> AppIconStatus {
|
||||
use crate::icon_data::IconDataExt as _;
|
||||
profiling::function_scope!();
|
||||
|
||||
use objc2::ClassType;
|
||||
use objc2::ClassType as _;
|
||||
use objc2_app_kit::{NSApplication, NSImage};
|
||||
use objc2_foundation::{NSData, NSString};
|
||||
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ pub fn create_storage(_app_name: &str) -> Option<Box<dyn epi::Storage>> {
|
|||
None
|
||||
}
|
||||
|
||||
#[allow(clippy::unnecessary_wraps)]
|
||||
#[expect(clippy::unnecessary_wraps)]
|
||||
pub fn create_storage_with_file(_file: impl Into<PathBuf>) -> Option<Box<dyn epi::Storage>> {
|
||||
#[cfg(feature = "persistence")]
|
||||
return Some(Box::new(
|
||||
|
|
@ -169,7 +169,7 @@ pub struct EpiIntegration {
|
|||
}
|
||||
|
||||
impl EpiIntegration {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
egui_ctx: egui::Context,
|
||||
window: &winit::window::Window,
|
||||
|
|
@ -326,7 +326,7 @@ impl EpiIntegration {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::unused_self)]
|
||||
#[allow(clippy::unused_self, clippy::allow_attributes)]
|
||||
pub fn save(&mut self, _app: &mut dyn epi::App, _window: Option<&winit::window::Window>) {
|
||||
#[cfg(feature = "persistence")]
|
||||
if let Some(storage) = self.frame.storage_mut() {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ impl Drop for EventLoopGuard {
|
|||
}
|
||||
|
||||
// Helper function to safely use the current event loop
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
pub fn with_current_event_loop<F, R>(f: F) -> Option<R>
|
||||
where
|
||||
F: FnOnce(&ActiveEventLoop) -> R,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use std::{
|
||||
collections::HashMap,
|
||||
io::Write,
|
||||
io::Write as _,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ pub fn storage_dir(app_id: &str) -> Option<PathBuf> {
|
|||
// Adapted from
|
||||
// https://github.com/rust-lang/cargo/blob/6e11c77384989726bb4f412a0e23b59c27222c34/crates/home/src/windows.rs#L19-L37
|
||||
#[cfg(all(windows, not(target_vendor = "uwp")))]
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
fn roaming_appdata() -> Option<PathBuf> {
|
||||
use std::ffi::OsString;
|
||||
use std::os::windows::ffi::OsStringExt;
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@ use std::{cell::RefCell, num::NonZeroU32, rc::Rc, sync::Arc, time::Instant};
|
|||
|
||||
use egui_winit::ActionRequested;
|
||||
use glutin::{
|
||||
config::GlConfig,
|
||||
context::NotCurrentGlContext,
|
||||
display::GetGlDisplay,
|
||||
prelude::{GlDisplay, PossiblyCurrentGlContext},
|
||||
surface::GlSurface,
|
||||
config::GlConfig as _,
|
||||
context::NotCurrentGlContext as _,
|
||||
display::GetGlDisplay as _,
|
||||
prelude::{GlDisplay as _, PossiblyCurrentGlContext as _},
|
||||
surface::GlSurface as _,
|
||||
};
|
||||
use raw_window_handle::HasWindowHandle;
|
||||
use raw_window_handle::HasWindowHandle as _;
|
||||
use winit::{
|
||||
event_loop::{ActiveEventLoop, EventLoop, EventLoopProxy},
|
||||
window::{Window, WindowId},
|
||||
|
|
@ -139,7 +139,7 @@ impl<'app> GlowWinitApp<'app> {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
fn create_glutin_windowed_context(
|
||||
egui_ctx: &egui::Context,
|
||||
event_loop: &ActiveEventLoop,
|
||||
|
|
@ -901,7 +901,7 @@ fn change_gl_context(
|
|||
}
|
||||
|
||||
impl GlutinWindowContext {
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
unsafe fn new(
|
||||
egui_ctx: &egui::Context,
|
||||
viewport_builder: ViewportBuilder,
|
||||
|
|
@ -1094,7 +1094,7 @@ impl GlutinWindowContext {
|
|||
}
|
||||
|
||||
/// Create a surface, window, and winit integration for the viewport, if missing.
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
pub(crate) fn initialize_window(
|
||||
&mut self,
|
||||
viewport_id: ViewportId,
|
||||
|
|
@ -1566,6 +1566,6 @@ fn save_screenshot_and_exit(
|
|||
});
|
||||
log::info!("Screenshot saved to {path:?}.");
|
||||
|
||||
#[allow(clippy::exit)]
|
||||
#[expect(clippy::exit)]
|
||||
std::process::exit(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,7 +163,6 @@ impl<T: WinitApp> WinitAppWrapper<T> {
|
|||
|
||||
log::debug!("Exiting with return code 0");
|
||||
|
||||
#[allow(clippy::exit)]
|
||||
std::process::exit(0);
|
||||
}
|
||||
}
|
||||
|
|
@ -317,7 +316,7 @@ impl<T: WinitApp> ApplicationHandler<UserEvent> for WinitAppWrapper<T> {
|
|||
|
||||
#[cfg(not(target_os = "ios"))]
|
||||
fn run_and_return(event_loop: &mut EventLoop<UserEvent>, winit_app: impl WinitApp) -> Result {
|
||||
use winit::platform::run_on_demand::EventLoopExtRunOnDemand;
|
||||
use winit::platform::run_on_demand::EventLoopExtRunOnDemand as _;
|
||||
|
||||
log::trace!("Entering the winit event loop (run_app_on_demand)…");
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use winit::{
|
|||
window::{Window, WindowId},
|
||||
};
|
||||
|
||||
use ahash::{HashMap, HashSet, HashSetExt};
|
||||
use ahash::{HashMap, HashSet, HashSetExt as _};
|
||||
use egui::{
|
||||
DeferredViewportUiCallback, FullOutput, ImmediateViewport, ViewportBuilder, ViewportClass,
|
||||
ViewportId, ViewportIdMap, ViewportIdPair, ViewportIdSet, ViewportInfo, ViewportOutput,
|
||||
|
|
@ -182,7 +182,6 @@ impl<'app> WgpuWinitApp<'app> {
|
|||
builder: ViewportBuilder,
|
||||
) -> crate::Result<&mut WgpuWinitRunning<'app>> {
|
||||
profiling::function_scope!();
|
||||
#[allow(unsafe_code, unused_mut, unused_unsafe)]
|
||||
let mut painter = pollster::block_on(egui_wgpu::winit::Painter::new(
|
||||
egui_ctx.clone(),
|
||||
self.native_options.wgpu_options.clone(),
|
||||
|
|
@ -236,7 +235,7 @@ impl<'app> WgpuWinitApp<'app> {
|
|||
});
|
||||
}
|
||||
|
||||
#[allow(unused_mut)] // used for accesskit
|
||||
#[allow(unused_mut, clippy::allow_attributes)] // used for accesskit
|
||||
let mut egui_winit = egui_winit::State::new(
|
||||
egui_ctx.clone(),
|
||||
ViewportId::ROOT,
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ use egui::{TexturesDelta, UserData, ViewportCommand};
|
|||
|
||||
use crate::{epi, App};
|
||||
|
||||
use super::{now_sec, text_agent::TextAgent, web_painter::WebPainter, NeedRepaint};
|
||||
use super::{now_sec, text_agent::TextAgent, web_painter::WebPainter as _, NeedRepaint};
|
||||
|
||||
pub struct AppRunner {
|
||||
#[allow(dead_code)]
|
||||
#[allow(dead_code, clippy::allow_attributes)]
|
||||
pub(crate) web_options: crate::WebOptions,
|
||||
pub(crate) frame: epi::Frame,
|
||||
egui_ctx: egui::Context,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use super::{
|
|||
button_from_mouse_event, location_hash, modifiers_from_kb_event, modifiers_from_mouse_event,
|
||||
modifiers_from_wheel_event, native_pixels_per_point, pos_from_mouse_event,
|
||||
prefers_color_scheme_dark, primary_touch_pos, push_touches, text_from_keyboard_event,
|
||||
theme_from_dark_mode, translate_key, AppRunner, Closure, JsCast, JsValue, WebRunner,
|
||||
theme_from_dark_mode, translate_key, AppRunner, Closure, JsCast as _, JsValue, WebRunner,
|
||||
DEBUG_RESIZE,
|
||||
};
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ fn install_keydown(runner_ref: &WebRunner, target: &EventTarget) -> Result<(), J
|
|||
)
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_pass_by_value)] // So that we can pass it directly to `add_event_listener`
|
||||
#[expect(clippy::needless_pass_by_value)] // So that we can pass it directly to `add_event_listener`
|
||||
pub(crate) fn on_keydown(event: web_sys::KeyboardEvent, runner: &mut AppRunner) {
|
||||
let has_focus = runner.input.raw.focused;
|
||||
if !has_focus {
|
||||
|
|
@ -261,7 +261,7 @@ fn install_keyup(runner_ref: &WebRunner, target: &EventTarget) -> Result<(), JsV
|
|||
runner_ref.add_event_listener(target, "keyup", on_keyup)
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_pass_by_value)] // So that we can pass it directly to `add_event_listener`
|
||||
#[expect(clippy::needless_pass_by_value)] // So that we can pass it directly to `add_event_listener`
|
||||
pub(crate) fn on_keyup(event: web_sys::KeyboardEvent, runner: &mut AppRunner) {
|
||||
let modifiers = modifiers_from_kb_event(&event);
|
||||
runner.input.raw.modifiers = modifiers;
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ fn create_clipboard_item(mime: &str, bytes: &[u8]) -> Result<web_sys::ClipboardI
|
|||
let items = js_sys::Object::new();
|
||||
|
||||
// SAFETY: I hope so
|
||||
#[allow(unsafe_code, unused_unsafe)] // Weird false positive
|
||||
#[expect(unsafe_code, unused_unsafe)] // Weird false positive
|
||||
unsafe {
|
||||
js_sys::Reflect::set(&items, &JsValue::from_str(mime), &blob)?
|
||||
};
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ mod console {
|
|||
/// * `tokio-1.24.1/src/runtime/runtime.rs`
|
||||
/// * `rerun/src/main.rs`
|
||||
/// * `core/src/ops/function.rs`
|
||||
#[allow(dead_code)] // only used on web and in tests
|
||||
#[allow(dead_code, clippy::allow_attributes)] // only used on web and in tests
|
||||
fn shorten_file_path(file_path: &str) -> &str {
|
||||
if let Some(i) = file_path.rfind("/src/") {
|
||||
if let Some(prev_slash) = file_path[..i].rfind('/') {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use egui::{Event, UserData, ViewportId};
|
||||
use egui_glow::glow;
|
||||
use std::sync::Arc;
|
||||
use wasm_bindgen::JsCast;
|
||||
use wasm_bindgen::JsCast as _;
|
||||
use wasm_bindgen::JsValue;
|
||||
use web_sys::HtmlCanvasElement;
|
||||
|
||||
|
|
@ -27,7 +27,8 @@ impl WebPainterGlow {
|
|||
) -> Result<Self, String> {
|
||||
let (gl, shader_prefix) =
|
||||
init_glow_context_from_canvas(&canvas, options.webgl_context_option)?;
|
||||
#[allow(clippy::arc_with_non_send_sync)]
|
||||
|
||||
#[allow(clippy::arc_with_non_send_sync, clippy::allow_attributes)] // For wasm
|
||||
let gl = std::sync::Arc::new(gl);
|
||||
|
||||
let painter = egui_glow::Painter::new(gl, shader_prefix, None, options.dithering)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ pub(crate) struct WebPainterWgpu {
|
|||
}
|
||||
|
||||
impl WebPainterWgpu {
|
||||
#[allow(unused)] // only used if `wgpu` is the only active feature.
|
||||
#[expect(unused)] // only used if `wgpu` is the only active feature.
|
||||
pub fn render_state(&self) -> Option<RenderState> {
|
||||
self.render_state.clone()
|
||||
}
|
||||
|
|
@ -55,7 +55,7 @@ impl WebPainterWgpu {
|
|||
})
|
||||
}
|
||||
|
||||
#[allow(unused)] // only used if `wgpu` is the only active feature.
|
||||
#[expect(unused)] // only used if `wgpu` is the only active feature.
|
||||
pub async fn new(
|
||||
ctx: egui::Context,
|
||||
canvas: web_sys::HtmlCanvasElement,
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ pub struct WebRunner {
|
|||
|
||||
impl WebRunner {
|
||||
/// Will install a panic handler that will catch and log any panics
|
||||
#[allow(clippy::new_without_default)]
|
||||
#[expect(clippy::new_without_default)]
|
||||
pub fn new() -> Self {
|
||||
let panic_handler = PanicHandler::install();
|
||||
|
||||
|
|
@ -280,7 +280,7 @@ struct TargetEvent {
|
|||
closure: Closure<dyn FnMut(web_sys::Event)>,
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
#[expect(unused)]
|
||||
struct IntervalHandle {
|
||||
handle: i32,
|
||||
closure: Closure<dyn FnMut()>,
|
||||
|
|
@ -289,7 +289,7 @@ struct IntervalHandle {
|
|||
enum EventToUnsubscribe {
|
||||
TargetEvent(TargetEvent),
|
||||
|
||||
#[allow(unused)]
|
||||
#[expect(unused)]
|
||||
IntervalHandle(IntervalHandle),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ use std::sync::{mpsc, Arc};
|
|||
use wgpu::{BindGroupLayout, MultisampleState, StoreOp};
|
||||
|
||||
/// A texture and a buffer for reading the rendered frame back to the cpu.
|
||||
///
|
||||
/// The texture is required since [`wgpu::TextureUsages::COPY_SRC`] is not an allowed
|
||||
/// flag for the surface texture on all platforms. This means that anytime we want to
|
||||
/// capture the frame, we first render it to this texture, and then we can copy it to
|
||||
|
|
@ -125,7 +126,7 @@ impl CaptureState {
|
|||
// It would be more efficient to reuse the Buffer, e.g. via some kind of ring buffer, but
|
||||
// for most screenshot use cases this should be fine. When taking many screenshots (e.g. for a video)
|
||||
// it might make sense to revisit this and implement a more efficient solution.
|
||||
#[allow(clippy::arc_with_non_send_sync)]
|
||||
#[allow(clippy::arc_with_non_send_sync, clippy::allow_attributes)] // For wasm
|
||||
let buffer = device.create_buffer(&wgpu::BufferDescriptor {
|
||||
label: Some("egui_screen_capture_buffer"),
|
||||
size: (self.padding.padded_bytes_per_row * self.texture.height()) as u64,
|
||||
|
|
@ -184,7 +185,7 @@ impl CaptureState {
|
|||
tx: CaptureSender,
|
||||
viewport_id: ViewportId,
|
||||
) {
|
||||
#[allow(clippy::arc_with_non_send_sync)]
|
||||
#[allow(clippy::arc_with_non_send_sync, clippy::allow_attributes)] // For wasm
|
||||
let buffer = Arc::new(buffer);
|
||||
let buffer_clone = buffer.clone();
|
||||
let buffer_slice = buffer_clone.slice(..);
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ impl RenderState {
|
|||
|
||||
// On wasm, depending on feature flags, wgpu objects may or may not implement sync.
|
||||
// It doesn't make sense to switch to Rc for that special usecase, so simply disable the lint.
|
||||
#[allow(clippy::arc_with_non_send_sync)]
|
||||
#[allow(clippy::arc_with_non_send_sync, clippy::allow_attributes)] // For wasm
|
||||
Ok(Self {
|
||||
adapter,
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
use std::{borrow::Cow, num::NonZeroU64, ops::Range};
|
||||
|
||||
use ahash::HashMap;
|
||||
use epaint::{emath::NumExt, PaintCallbackInfo, Primitive, Vertex};
|
||||
use epaint::{emath::NumExt as _, PaintCallbackInfo, Primitive, Vertex};
|
||||
|
||||
use wgpu::util::DeviceExt as _;
|
||||
|
||||
|
|
@ -749,7 +749,7 @@ impl Renderer {
|
|||
///
|
||||
/// The texture must have the format [`wgpu::TextureFormat::Rgba8UnormSrgb`].
|
||||
/// Any compare function supplied in the [`wgpu::SamplerDescriptor`] will be ignored.
|
||||
#[allow(clippy::needless_pass_by_value)] // false positive
|
||||
#[expect(clippy::needless_pass_by_value)] // false positive
|
||||
pub fn register_native_texture_with_sampler_options(
|
||||
&mut self,
|
||||
device: &wgpu::Device,
|
||||
|
|
@ -796,7 +796,7 @@ impl Renderer {
|
|||
/// [`wgpu::SamplerDescriptor`] options.
|
||||
///
|
||||
/// This allows applications to reuse [`epaint::TextureId`]s created with custom sampler options.
|
||||
#[allow(clippy::needless_pass_by_value)] // false positive
|
||||
#[expect(clippy::needless_pass_by_value)] // false positive
|
||||
pub fn update_egui_texture_from_wgpu_texture_with_sampler_options(
|
||||
&mut self,
|
||||
device: &wgpu::Device,
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ impl WgpuSetup {
|
|||
pub async fn new_instance(&self) -> wgpu::Instance {
|
||||
match self {
|
||||
Self::CreateNew(create_new) => {
|
||||
#[allow(unused_mut)]
|
||||
#[allow(unused_mut, clippy::allow_attributes)]
|
||||
let mut backends = create_new.instance_descriptor.backends;
|
||||
|
||||
// Don't try WebGPU if we're not in a secure context.
|
||||
|
|
|
|||
|
|
@ -575,7 +575,7 @@ impl Painter {
|
|||
.retain(|id, _| active_viewports.contains(id));
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_pass_by_ref_mut, clippy::unused_self)]
|
||||
#[expect(clippy::needless_pass_by_ref_mut, clippy::unused_self)]
|
||||
pub fn destroy(&mut self) {
|
||||
// TODO(emilk): something here?
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ fn init_smithay_clipboard(
|
|||
|
||||
if let Some(RawDisplayHandle::Wayland(display)) = raw_display_handle {
|
||||
log::trace!("Initializing smithay clipboard…");
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
Some(unsafe { smithay_clipboard::Clipboard::new(display.display.as_ptr()) })
|
||||
} else {
|
||||
#[cfg(feature = "wayland")]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/// A cache, storing some value for some length of time.
|
||||
#[allow(clippy::len_without_is_empty)]
|
||||
#[expect(clippy::len_without_is_empty)]
|
||||
pub trait CacheTrait: 'static + Send + Sync {
|
||||
/// Call once per frame to evict cache.
|
||||
fn update(&mut self);
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
use emath::GuiRounding as _;
|
||||
|
||||
use crate::{
|
||||
emath, pos2, Align2, Context, Id, InnerResponse, LayerId, Layout, NumExt, Order, Pos2, Rect,
|
||||
Response, Sense, Ui, UiBuilder, UiKind, UiStackInfo, Vec2, WidgetRect, WidgetWithState,
|
||||
emath, pos2, Align2, Context, Id, InnerResponse, LayerId, Layout, NumExt as _, Order, Pos2,
|
||||
Rect, Response, Sense, Ui, UiBuilder, UiKind, UiStackInfo, Vec2, WidgetRect, WidgetWithState,
|
||||
};
|
||||
|
||||
/// State of an [`Area`] that is persisted between frames.
|
||||
|
|
@ -602,7 +602,7 @@ impl Prepared {
|
|||
self.move_response.id
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_pass_by_value)] // intentional to swallow up `content_ui`.
|
||||
#[expect(clippy::needless_pass_by_value)] // intentional to swallow up `content_ui`.
|
||||
pub(crate) fn end(self, ctx: &Context, content_ui: Ui) -> Response {
|
||||
let Self {
|
||||
info: _,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use std::hash::Hash;
|
||||
|
||||
use crate::{
|
||||
emath, epaint, pos2, remap, remap_clamp, vec2, Context, Id, InnerResponse, NumExt, Rect,
|
||||
emath, epaint, pos2, remap, remap_clamp, vec2, Context, Id, InnerResponse, NumExt as _, Rect,
|
||||
Response, Sense, Stroke, TextStyle, TextWrapMode, Ui, UiBuilder, UiKind, UiStackInfo, Vec2,
|
||||
WidgetInfo, WidgetText, WidgetType,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ use epaint::Shape;
|
|||
|
||||
use crate::{
|
||||
epaint, style::StyleModifier, style::WidgetVisuals, vec2, Align2, Context, Id, InnerResponse,
|
||||
NumExt, Painter, Popup, PopupCloseBehavior, Rect, Response, ScrollArea, Sense, Stroke,
|
||||
NumExt as _, Painter, Popup, PopupCloseBehavior, Rect, Response, ScrollArea, Sense, Stroke,
|
||||
TextStyle, TextWrapMode, Ui, UiBuilder, Vec2, WidgetInfo, WidgetText, WidgetType,
|
||||
};
|
||||
|
||||
#[allow(unused_imports)] // Documentation
|
||||
#[expect(unused_imports)] // Documentation
|
||||
use crate::style::Spacing;
|
||||
|
||||
/// A function that paints the [`ComboBox`] icon
|
||||
|
|
@ -297,7 +297,7 @@ impl ComboBox {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
fn combo_box_dyn<'c, R>(
|
||||
ui: &mut Ui,
|
||||
button_id: Id,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::style::StyleModifier;
|
||||
use crate::{
|
||||
Button, Color32, Context, Frame, Id, InnerResponse, Layout, Popup, PopupCloseBehavior,
|
||||
Response, Style, Ui, UiBuilder, UiKind, UiStack, UiStackInfo, Widget, WidgetText,
|
||||
Response, Style, Ui, UiBuilder, UiKind, UiStack, UiStackInfo, Widget as _, WidgetText,
|
||||
};
|
||||
use emath::{vec2, Align, RectAlign, Vec2};
|
||||
use epaint::Stroke;
|
||||
|
|
@ -159,6 +159,7 @@ impl MenuState {
|
|||
}
|
||||
|
||||
/// Horizontal menu bar where you can add [`MenuButton`]s.
|
||||
///
|
||||
/// The menu bar goes well in a [`crate::TopBottomPanel::top`],
|
||||
/// but can also be placed in a [`crate::Window`].
|
||||
/// In the latter case you may want to wrap it in [`Frame`].
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
use crate::containers::tooltip::Tooltip;
|
||||
use crate::{
|
||||
Align, Context, Id, LayerId, Layout, Popup, PopupAnchor, PopupCloseBehavior, Pos2, Rect,
|
||||
Response, Ui, Widget, WidgetText,
|
||||
Response, Ui, Widget as _, WidgetText,
|
||||
};
|
||||
use emath::RectAlign;
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
@ -19,7 +19,7 @@ use emath::RectAlign;
|
|||
///
|
||||
/// ```
|
||||
/// # egui::__run_test_ui(|ui| {
|
||||
/// # #[allow(deprecated)]
|
||||
/// # #[expect(deprecated)]
|
||||
/// if ui.ui_contains_pointer() {
|
||||
/// egui::show_tooltip(ui.ctx(), ui.layer_id(), egui::Id::new("my_tooltip"), |ui| {
|
||||
/// ui.label("Helpful text");
|
||||
|
|
@ -177,7 +177,7 @@ pub fn popup_below_widget<R>(
|
|||
/// }
|
||||
/// let below = egui::AboveOrBelow::Below;
|
||||
/// let close_on_click_outside = egui::PopupCloseBehavior::CloseOnClickOutside;
|
||||
/// # #[allow(deprecated)]
|
||||
/// # #[expect(deprecated)]
|
||||
/// egui::popup_above_or_below_widget(ui, popup_id, &response, below, close_on_click_outside, |ui| {
|
||||
/// ui.set_min_width(200.0); // if you want to control the size
|
||||
/// ui.label("Some more info, or things you can select:");
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
use emath::GuiRounding as _;
|
||||
|
||||
use crate::{
|
||||
lerp, vec2, Align, Context, CursorIcon, Frame, Id, InnerResponse, LayerId, Layout, NumExt,
|
||||
lerp, vec2, Align, Context, CursorIcon, Frame, Id, InnerResponse, LayerId, Layout, NumExt as _,
|
||||
Rangef, Rect, Sense, Stroke, Ui, UiBuilder, UiKind, UiStackInfo, Vec2,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -466,7 +466,7 @@ impl<'a> Popup<'a> {
|
|||
};
|
||||
|
||||
RectAlign::find_best_align(
|
||||
#[allow(clippy::iter_on_empty_collections)]
|
||||
#[expect(clippy::iter_on_empty_collections)]
|
||||
once(self.rect_align).chain(
|
||||
self.alternative_aligns
|
||||
// Need the empty slice so the iters have the same type so we can unwrap_or
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
pos2, vec2, Align2, Color32, Context, CursorIcon, Id, NumExt, Rect, Response, Sense, Shape, Ui,
|
||||
UiBuilder, UiKind, UiStackInfo, Vec2, Vec2b,
|
||||
pos2, vec2, Align2, Color32, Context, CursorIcon, Id, NumExt as _, Rect, Response, Sense,
|
||||
Shape, Ui, UiBuilder, UiKind, UiStackInfo, Vec2, Vec2b,
|
||||
};
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use core::f32;
|
||||
|
||||
use emath::{GuiRounding, Pos2};
|
||||
use emath::{GuiRounding as _, Pos2};
|
||||
|
||||
use crate::{
|
||||
emath::TSTransform, InnerResponse, LayerId, PointerButton, Rangef, Rect, Response, Sense, Ui,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
#![allow(clippy::needless_range_loop)]
|
||||
|
||||
use crate::{
|
||||
emath, epaint, lerp, pass_state, pos2, remap, remap_clamp, Context, Id, NumExt, Pos2, Rangef,
|
||||
Rect, Sense, Ui, UiBuilder, UiKind, UiStackInfo, Vec2, Vec2b,
|
||||
emath, epaint, lerp, pass_state, pos2, remap, remap_clamp, Context, Id, NumExt as _, Pos2,
|
||||
Rangef, Rect, Sense, Ui, UiBuilder, UiKind, UiStackInfo, Vec2, Vec2b,
|
||||
};
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
|
|
|
|||
|
|
@ -34,9 +34,10 @@ use crate::{
|
|||
viewport::ViewportClass,
|
||||
Align2, CursorIcon, DeferredViewportUiCallback, FontDefinitions, Grid, Id, ImmediateViewport,
|
||||
ImmediateViewportRendererCallback, Key, KeyboardShortcut, Label, LayerId, Memory,
|
||||
ModifierNames, NumExt, Order, Painter, RawInput, Response, RichText, ScrollArea, Sense, Style,
|
||||
TextStyle, TextureHandle, TextureOptions, Ui, ViewportBuilder, ViewportCommand, ViewportId,
|
||||
ViewportIdMap, ViewportIdPair, ViewportIdSet, ViewportOutput, Widget, WidgetRect, WidgetText,
|
||||
ModifierNames, NumExt as _, Order, Painter, RawInput, Response, RichText, ScrollArea, Sense,
|
||||
Style, TextStyle, TextureHandle, TextureOptions, Ui, ViewportBuilder, ViewportCommand,
|
||||
ViewportId, ViewportIdMap, ViewportIdPair, ViewportIdSet, ViewportOutput, Widget as _,
|
||||
WidgetRect, WidgetText,
|
||||
};
|
||||
|
||||
#[cfg(feature = "accesskit")]
|
||||
|
|
@ -314,7 +315,7 @@ impl std::fmt::Display for RepaintCause {
|
|||
|
||||
impl RepaintCause {
|
||||
/// Capture the file and line number of the call site.
|
||||
#[allow(clippy::new_without_default)]
|
||||
#[expect(clippy::new_without_default)]
|
||||
#[track_caller]
|
||||
pub fn new() -> Self {
|
||||
let caller = Location::caller();
|
||||
|
|
@ -327,7 +328,6 @@ impl RepaintCause {
|
|||
|
||||
/// Capture the file and line number of the call site,
|
||||
/// as well as add a reason.
|
||||
#[allow(clippy::new_without_default)]
|
||||
#[track_caller]
|
||||
pub fn new_reason(reason: impl Into<Cow<'static, str>>) -> Self {
|
||||
let caller = Location::caller();
|
||||
|
|
@ -1160,7 +1160,6 @@ impl Context {
|
|||
///
|
||||
/// `allow_focus` should usually be true, unless you call this function multiple times with the
|
||||
/// same widget, then `allow_focus` should only be true once (like in [`Ui::new`] (true) and [`Ui::remember_min_rect`] (false)).
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(crate) fn create_widget(&self, w: WidgetRect, allow_focus: bool) -> Response {
|
||||
let interested_in_focus = w.enabled
|
||||
&& w.sense.is_focusable()
|
||||
|
|
@ -1189,7 +1188,7 @@ impl Context {
|
|||
self.check_for_id_clash(w.id, w.rect, "widget");
|
||||
}
|
||||
|
||||
#[allow(clippy::let_and_return)]
|
||||
#[allow(clippy::let_and_return, clippy::allow_attributes)]
|
||||
let res = self.get_response(w);
|
||||
|
||||
#[cfg(feature = "accesskit")]
|
||||
|
|
@ -2350,7 +2349,6 @@ impl ContextImpl {
|
|||
// Inform the backend of all textures that have been updated (including font atlas).
|
||||
let textures_delta = self.tex_manager.0.write().take_delta();
|
||||
|
||||
#[cfg_attr(not(feature = "accesskit"), allow(unused_mut))]
|
||||
let mut platform_output: PlatformOutput = std::mem::take(&mut viewport.output);
|
||||
|
||||
#[cfg(feature = "accesskit")]
|
||||
|
|
@ -2651,7 +2649,7 @@ impl Context {
|
|||
/// Is an egui context menu open?
|
||||
///
|
||||
/// This only works with the old, deprecated [`crate::menu`] API.
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
#[deprecated = "Use `is_popup_open` instead"]
|
||||
pub fn is_context_menu_open(&self) -> bool {
|
||||
self.data(|d| {
|
||||
|
|
@ -3205,7 +3203,7 @@ impl Context {
|
|||
}
|
||||
});
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(format!(
|
||||
"{} menu bars",
|
||||
|
|
@ -3263,7 +3261,7 @@ impl Context {
|
|||
/// the function is still called, but with no other effect.
|
||||
///
|
||||
/// No locks are held while the given closure is called.
|
||||
#[allow(clippy::unused_self, clippy::let_and_return)]
|
||||
#[allow(clippy::unused_self, clippy::let_and_return, clippy::allow_attributes)]
|
||||
#[inline]
|
||||
pub fn with_accessibility_parent<R>(&self, _id: Id, f: impl FnOnce() -> R) -> R {
|
||||
// TODO(emilk): this isn't thread-safe - another thread can call this function between the push/pop calls
|
||||
|
|
@ -3596,7 +3594,6 @@ impl Context {
|
|||
/// * Set the window attributes (position, size, …) based on [`ImmediateViewport::builder`].
|
||||
/// * Call [`Context::run`] with [`ImmediateViewport::viewport_ui_cb`].
|
||||
/// * Handle the output from [`Context::run`], including rendering
|
||||
#[allow(clippy::unused_self)]
|
||||
pub fn set_immediate_viewport_renderer(
|
||||
callback: impl for<'a> Fn(&Self, ImmediateViewport<'a>) + 'static,
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -1233,7 +1233,7 @@ pub struct EventFilter {
|
|||
pub escape: bool,
|
||||
}
|
||||
|
||||
#[allow(clippy::derivable_impls)] // let's be explicit
|
||||
#[expect(clippy::derivable_impls)] // let's be explicit
|
||||
impl Default for EventFilter {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ pub struct OpenUrl {
|
|||
}
|
||||
|
||||
impl OpenUrl {
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
pub fn same_tab(url: impl ToString) -> Self {
|
||||
Self {
|
||||
url: url.to_string(),
|
||||
|
|
@ -260,7 +260,7 @@ impl OpenUrl {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
pub fn new_tab(url: impl ToString) -> Self {
|
||||
Self {
|
||||
url: url.to_string(),
|
||||
|
|
@ -607,7 +607,7 @@ impl WidgetInfo {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
pub fn labeled(typ: WidgetType, enabled: bool, label: impl ToString) -> Self {
|
||||
Self {
|
||||
enabled,
|
||||
|
|
@ -617,7 +617,7 @@ impl WidgetInfo {
|
|||
}
|
||||
|
||||
/// checkboxes, radio-buttons etc
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
pub fn selected(typ: WidgetType, enabled: bool, selected: bool, label: impl ToString) -> Self {
|
||||
Self {
|
||||
enabled,
|
||||
|
|
@ -635,7 +635,7 @@ impl WidgetInfo {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
pub fn slider(enabled: bool, value: f64, label: impl ToString) -> Self {
|
||||
let label = label.to_string();
|
||||
Self {
|
||||
|
|
@ -646,7 +646,7 @@ impl WidgetInfo {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
pub fn text_edit(
|
||||
enabled: bool,
|
||||
prev_text_value: impl ToString,
|
||||
|
|
@ -670,7 +670,7 @@ impl WidgetInfo {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
pub fn text_selection_changed(
|
||||
enabled: bool,
|
||||
text_selection: std::ops::RangeInclusive<usize>,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use emath::GuiRounding as _;
|
||||
|
||||
use crate::{
|
||||
vec2, Align2, Color32, Context, Id, InnerResponse, NumExt, Painter, Rect, Region, Style, Ui,
|
||||
UiBuilder, Vec2,
|
||||
vec2, Align2, Color32, Context, Id, InnerResponse, NumExt as _, Painter, Rect, Region, Style,
|
||||
Ui, UiBuilder, Vec2,
|
||||
};
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
|
|
@ -184,7 +184,7 @@ impl GridLayout {
|
|||
Rect::from_min_size(cursor.min, size).round_ui()
|
||||
}
|
||||
|
||||
#[allow(clippy::unused_self)]
|
||||
#[expect(clippy::unused_self)]
|
||||
pub(crate) fn align_size_within_rect(&self, size: Vec2, frame: Rect) -> Rect {
|
||||
// TODO(emilk): allow this alignment to be customized
|
||||
Align2::LEFT_CENTER
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ impl Id {
|
|||
|
||||
/// Generate a new [`Id`] by hashing the parent [`Id`] and the given argument.
|
||||
pub fn with(self, child: impl std::hash::Hash) -> Self {
|
||||
use std::hash::{BuildHasher, Hasher};
|
||||
use std::hash::{BuildHasher as _, Hasher as _};
|
||||
let mut hasher = ahash::RandomState::with_seeds(1, 2, 3, 4).build_hasher();
|
||||
hasher.write_u64(self.0.get());
|
||||
child.hash(&mut hasher);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use crate::data::input::{
|
|||
TouchDeviceId, ViewportInfo, NUM_POINTER_BUTTONS,
|
||||
};
|
||||
use crate::{
|
||||
emath::{vec2, NumExt, Pos2, Rect, Vec2},
|
||||
emath::{vec2, NumExt as _, Pos2, Rect, Vec2},
|
||||
util::History,
|
||||
};
|
||||
use std::{
|
||||
|
|
@ -344,7 +344,7 @@ impl InputState {
|
|||
|
||||
let is_zoom = modifiers.ctrl || modifiers.mac_cmd || modifiers.command;
|
||||
|
||||
#[allow(clippy::collapsible_else_if)]
|
||||
#[expect(clippy::collapsible_else_if)]
|
||||
if is_zoom {
|
||||
if is_smooth {
|
||||
smooth_scroll_delta_for_zoom += delta.y;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
//! Showing UI:s for egui/epaint types.
|
||||
use crate::{
|
||||
epaint, memory, pos2, remap_clamp, vec2, Color32, CursorIcon, FontFamily, FontId, Label, Mesh,
|
||||
NumExt, Rect, Response, Sense, Shape, Slider, TextStyle, TextWrapMode, Ui, Widget,
|
||||
NumExt as _, Rect, Response, Sense, Shape, Slider, TextStyle, TextWrapMode, Ui, Widget,
|
||||
};
|
||||
|
||||
pub fn font_family_ui(ui: &mut Ui, font_family: &mut FontFamily) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use emath::GuiRounding as _;
|
||||
|
||||
use crate::{
|
||||
emath::{pos2, vec2, Align2, NumExt, Pos2, Rect, Vec2},
|
||||
emath::{pos2, vec2, Align2, NumExt as _, Pos2, Rect, Vec2},
|
||||
Align,
|
||||
};
|
||||
const INFINITY: f32 = f32::INFINITY;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ use std::{
|
|||
|
||||
use ahash::HashMap;
|
||||
|
||||
use emath::{Float, OrderedFloat};
|
||||
use emath::{Float as _, OrderedFloat};
|
||||
use epaint::{mutex::Mutex, textures::TextureOptions, ColorImage, TextureHandle, TextureId, Vec2};
|
||||
|
||||
use crate::Context;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ impl DefaultBytesLoader {
|
|||
}
|
||||
|
||||
impl BytesLoader for DefaultBytesLoader {
|
||||
fn id(&self) -> &str {
|
||||
fn id(&self) -> &'static str {
|
||||
generate_loader_id!(DefaultBytesLoader)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
use super::{
|
||||
BytesLoader, Context, HashMap, ImagePoll, Mutex, SizeHint, SizedTexture, TextureHandle,
|
||||
BytesLoader as _, Context, HashMap, ImagePoll, Mutex, SizeHint, SizedTexture, TextureHandle,
|
||||
TextureLoadResult, TextureLoader, TextureOptions, TexturePoll,
|
||||
};
|
||||
|
||||
|
|
@ -11,7 +11,7 @@ pub struct DefaultTextureLoader {
|
|||
}
|
||||
|
||||
impl TextureLoader for DefaultTextureLoader {
|
||||
fn id(&self) -> &str {
|
||||
fn id(&self) -> &'static str {
|
||||
crate::generate_loader_id!(DefaultTextureLoader)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ use super::{
|
|||
use crate::{
|
||||
epaint, vec2,
|
||||
widgets::{Button, ImageButton},
|
||||
Align2, Area, Color32, Frame, Key, LayerId, Layout, NumExt, Order, Stroke, Style, TextWrapMode,
|
||||
UiKind, WidgetText,
|
||||
Align2, Area, Color32, Frame, Key, LayerId, Layout, NumExt as _, Order, Stroke, Style,
|
||||
TextWrapMode, UiKind, WidgetText,
|
||||
};
|
||||
use epaint::mutex::RwLock;
|
||||
use std::sync::Arc;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/// An `enum` of common operating systems.
|
||||
#[allow(clippy::upper_case_acronyms)] // `Ios` looks too ugly
|
||||
#[expect(clippy::upper_case_acronyms)] // `Ios` looks too ugly
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum OperatingSystem {
|
||||
/// Unknown OS - could be wasm
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ impl Painter {
|
|||
|
||||
/// ## Debug painting
|
||||
impl Painter {
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
pub fn debug_rect(&self, rect: Rect, color: Color32, text: impl ToString) {
|
||||
self.rect(
|
||||
rect,
|
||||
|
|
@ -320,7 +320,7 @@ impl Painter {
|
|||
/// Text with a background.
|
||||
///
|
||||
/// See also [`Context::debug_text`].
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
pub fn debug_text(
|
||||
&self,
|
||||
pos: Pos2,
|
||||
|
|
@ -497,7 +497,7 @@ impl Painter {
|
|||
/// [`Self::layout`] or [`Self::layout_no_wrap`].
|
||||
///
|
||||
/// Returns where the text ended up.
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
pub fn text(
|
||||
&self,
|
||||
pos: Pos2,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use ahash::HashMap;
|
|||
use crate::{id::IdSet, style, Align, Id, IdMap, LayerId, Rangef, Rect, Vec2, WidgetRects};
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
use crate::{pos2, Align2, Color32, FontId, NumExt, Painter};
|
||||
use crate::{pos2, Align2, Color32, FontId, NumExt as _, Painter};
|
||||
|
||||
/// Reset at the start of each frame.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
|
|
|
|||
|
|
@ -747,7 +747,8 @@ impl ScrollStyle {
|
|||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/// Scroll animation configuration, used when programmatically scrolling somewhere (e.g. with `[crate::Ui::scroll_to_cursor]`)
|
||||
/// Scroll animation configuration, used when programmatically scrolling somewhere (e.g. with `[crate::Ui::scroll_to_cursor]`).
|
||||
///
|
||||
/// The animation duration is calculated based on the distance to be scrolled via `[ScrollAnimation::points_per_second]`
|
||||
/// and can be clamped to a min / max duration via `[ScrollAnimation::duration]`.
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
|
|
@ -1260,7 +1261,7 @@ pub fn default_text_styles() -> BTreeMap<TextStyle, FontId> {
|
|||
|
||||
impl Default for Style {
|
||||
fn default() -> Self {
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
Self {
|
||||
override_font_id: None,
|
||||
override_text_style: None,
|
||||
|
|
@ -1562,7 +1563,7 @@ use crate::{
|
|||
|
||||
impl Style {
|
||||
pub fn ui(&mut self, ui: &mut crate::Ui) {
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
let Self {
|
||||
override_font_id,
|
||||
override_text_style,
|
||||
|
|
|
|||
|
|
@ -616,7 +616,7 @@ impl LabelSelectionState {
|
|||
let old_primary = old_selection.map(|s| s.primary);
|
||||
let new_primary = self.selection.as_ref().map(|s| s.primary);
|
||||
if let Some(new_primary) = new_primary {
|
||||
let primary_changed = old_primary.map_or(true, |old| {
|
||||
let primary_changed = old_primary.is_none_or(|old| {
|
||||
old.widget_id != new_primary.widget_id || old.ccursor != new_primary.ccursor
|
||||
});
|
||||
if primary_changed && new_primary.widget_id == widget_id {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
//! Text cursor changes/interaction, without modifying the text.
|
||||
|
||||
use epaint::text::{cursor::CCursor, Galley};
|
||||
use unicode_segmentation::UnicodeSegmentation;
|
||||
use unicode_segmentation::UnicodeSegmentation as _;
|
||||
|
||||
use crate::{epaint, NumExt, Rect, Response, Ui};
|
||||
use crate::{epaint, NumExt as _, Rect, Response, Ui};
|
||||
|
||||
use super::CCursorRange;
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ pub struct Ui {
|
|||
sizing_pass: bool,
|
||||
|
||||
/// Indicates whether this Ui belongs to a Menu.
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
menu_state: Option<Arc<RwLock<crate::menu::MenuState>>>,
|
||||
|
||||
/// The [`UiStack`] for this [`Ui`].
|
||||
|
|
@ -666,7 +666,7 @@ impl Ui {
|
|||
///
|
||||
/// This is determined first by [`Style::wrap_mode`], and then by the layout of this [`Ui`].
|
||||
pub fn wrap_mode(&self) -> TextWrapMode {
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
if let Some(wrap_mode) = self.style.wrap_mode {
|
||||
wrap_mode
|
||||
}
|
||||
|
|
@ -3015,7 +3015,7 @@ impl Ui {
|
|||
self.close_kind(UiKind::Menu);
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
pub(crate) fn set_menu_state(
|
||||
&mut self,
|
||||
menu_state: Option<Arc<RwLock<crate::menu::MenuState>>>,
|
||||
|
|
@ -3156,7 +3156,7 @@ impl Drop for Ui {
|
|||
/// Show this rectangle to the user if certain debug options are set.
|
||||
#[cfg(debug_assertions)]
|
||||
fn register_rect(ui: &Ui, rect: Rect) {
|
||||
use emath::{Align2, GuiRounding};
|
||||
use emath::{Align2, GuiRounding as _};
|
||||
|
||||
let debug = ui.style().debug;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use std::{hash::Hash, sync::Arc};
|
||||
|
||||
use crate::close_tag::ClosableTag;
|
||||
#[allow(unused_imports)] // Used for doclinks
|
||||
#[expect(unused_imports)] // Used for doclinks
|
||||
use crate::Ui;
|
||||
use crate::{Id, LayerId, Layout, Rect, Sense, Style, UiStackInfo};
|
||||
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ impl UiStack {
|
|||
// these methods act on the entire stack
|
||||
impl UiStack {
|
||||
/// Return an iterator that walks the stack from this node to the root.
|
||||
#[allow(clippy::iter_without_into_iter)]
|
||||
#[expect(clippy::iter_without_into_iter)]
|
||||
pub fn iter(&self) -> UiStackIterator<'_> {
|
||||
UiStackIterator { next: Some(self) }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -467,7 +467,7 @@ impl IdTypeMap {
|
|||
|
||||
/// For tests
|
||||
#[cfg(feature = "persistence")]
|
||||
#[allow(unused)]
|
||||
#[allow(unused, clippy::allow_attributes)]
|
||||
fn get_generation<T: SerializableAny>(&self, id: Id) -> Option<usize> {
|
||||
let element = self.map.get(&hash(TypeId::of::<T>(), id))?;
|
||||
match element {
|
||||
|
|
|
|||
|
|
@ -260,7 +260,6 @@ pub type ImmediateViewportRendererCallback = dyn for<'a> Fn(&Context, ImmediateV
|
|||
/// The default values are implementation defined, so you may want to explicitly
|
||||
/// configure the size of the window, and what buttons are shown.
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq)]
|
||||
#[allow(clippy::option_option)]
|
||||
pub struct ViewportBuilder {
|
||||
/// The title of the viewport.
|
||||
/// `eframe` will use this as the title of the native window.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
widgets, Align, Color32, CornerRadius, FontSelection, Image, NumExt, Rect, Response, Sense,
|
||||
Stroke, TextStyle, TextWrapMode, Ui, Vec2, Widget, WidgetInfo, WidgetText, WidgetType,
|
||||
widgets, Align, Color32, CornerRadius, FontSelection, Image, NumExt as _, Rect, Response,
|
||||
Sense, Stroke, TextStyle, TextWrapMode, Ui, Vec2, Widget, WidgetInfo, WidgetText, WidgetType,
|
||||
};
|
||||
|
||||
/// Clickable button with text.
|
||||
|
|
@ -46,13 +46,11 @@ impl<'a> Button<'a> {
|
|||
}
|
||||
|
||||
/// Creates a button with an image. The size of the image as displayed is defined by the provided size.
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
pub fn image(image: impl Into<Image<'a>>) -> Self {
|
||||
Self::opt_image_and_text(Some(image.into()), None)
|
||||
}
|
||||
|
||||
/// Creates a button with an image to the left of the text. The size of the image as displayed is defined by the provided size.
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
pub fn image_and_text(image: impl Into<Image<'a>>, text: impl Into<WidgetText>) -> Self {
|
||||
Self::opt_image_and_text(Some(image.into()), Some(text.into()))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
epaint, pos2, vec2, NumExt, Response, Sense, Shape, TextStyle, Ui, Vec2, Widget, WidgetInfo,
|
||||
WidgetText, WidgetType,
|
||||
epaint, pos2, vec2, NumExt as _, Response, Sense, Shape, TextStyle, Ui, Vec2, Widget,
|
||||
WidgetInfo, WidgetText, WidgetType,
|
||||
};
|
||||
|
||||
// TODO(emilk): allow checkbox without a text label
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
use crate::util::fixed_cache::FixedCache;
|
||||
use crate::{
|
||||
epaint, lerp, remap_clamp, Area, Context, DragValue, Frame, Id, Key, Order, Painter, Response,
|
||||
Sense, Ui, UiKind, Widget, WidgetInfo, WidgetType,
|
||||
Sense, Ui, UiKind, Widget as _, WidgetInfo, WidgetType,
|
||||
};
|
||||
use epaint::{
|
||||
ecolor::{Color32, Hsva, HsvaGamma, Rgba},
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
use std::{cmp::Ordering, ops::RangeInclusive};
|
||||
|
||||
use crate::{
|
||||
emath, text, Button, CursorIcon, Key, Modifiers, NumExt, Response, RichText, Sense, TextEdit,
|
||||
TextWrapMode, Ui, Widget, WidgetInfo, MINUS_CHAR_STR,
|
||||
emath, text, Button, CursorIcon, Key, Modifiers, NumExt as _, Response, RichText, Sense,
|
||||
TextEdit, TextWrapMode, Ui, Widget, WidgetInfo, MINUS_CHAR_STR,
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
@ -550,7 +550,7 @@ impl Widget for DragValue<'_> {
|
|||
}
|
||||
|
||||
// some clones below are redundant if AccessKit is disabled
|
||||
#[allow(clippy::redundant_clone)]
|
||||
#[expect(clippy::redundant_clone)]
|
||||
let mut response = if is_kb_editing {
|
||||
let mut value_text = ui
|
||||
.data_mut(|data| data.remove_temp::<String>(id))
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ pub struct Hyperlink {
|
|||
}
|
||||
|
||||
impl Hyperlink {
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
pub fn new(url: impl ToString) -> Self {
|
||||
let url = url.to_string();
|
||||
Self {
|
||||
|
|
@ -106,7 +106,7 @@ impl Hyperlink {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
pub fn from_label_and_url(text: impl Into<WidgetText>, url: impl ToString) -> Self {
|
||||
Self {
|
||||
url: url.to_string(),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
lerp, vec2, Color32, CornerRadius, NumExt, Pos2, Rect, Response, Rgba, Sense, Shape, Stroke,
|
||||
TextStyle, TextWrapMode, Ui, Vec2, Widget, WidgetInfo, WidgetText, WidgetType,
|
||||
lerp, vec2, Color32, CornerRadius, NumExt as _, Pos2, Rect, Response, Rgba, Sense, Shape,
|
||||
Stroke, TextStyle, TextWrapMode, Ui, Vec2, Widget, WidgetInfo, WidgetText, WidgetType,
|
||||
};
|
||||
|
||||
enum ProgressBarText {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{
|
||||
epaint, pos2, vec2, NumExt, Response, Sense, TextStyle, Ui, Vec2, Widget, WidgetInfo,
|
||||
epaint, pos2, vec2, NumExt as _, Response, Sense, TextStyle, Ui, Vec2, Widget, WidgetInfo,
|
||||
WidgetText, WidgetType,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
use crate::{NumExt, Response, Sense, TextStyle, Ui, Widget, WidgetInfo, WidgetText, WidgetType};
|
||||
use crate::{
|
||||
NumExt as _, Response, Sense, TextStyle, Ui, Widget, WidgetInfo, WidgetText, WidgetType,
|
||||
};
|
||||
|
||||
/// One out of several alternatives, either selected or not.
|
||||
/// Will mark selected items with a different background color.
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ use std::ops::RangeInclusive;
|
|||
|
||||
use crate::{
|
||||
emath, epaint, lerp, pos2, remap, remap_clamp, style, style::HandleShape, vec2, Color32,
|
||||
DragValue, EventFilter, Key, Label, NumExt, Pos2, Rangef, Rect, Response, Sense, TextStyle,
|
||||
TextWrapMode, Ui, Vec2, Widget, WidgetInfo, WidgetText, MINUS_CHAR_STR,
|
||||
DragValue, EventFilter, Key, Label, NumExt as _, Pos2, Rangef, Rect, Response, Sense,
|
||||
TextStyle, TextWrapMode, Ui, Vec2, Widget, WidgetInfo, WidgetText, MINUS_CHAR_STR,
|
||||
};
|
||||
|
||||
use super::drag_value::clamp_value_to_range;
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ use crate::{
|
|||
response, text_selection,
|
||||
text_selection::{text_cursor_state::cursor_rect, visuals::paint_text_selection, CCursorRange},
|
||||
vec2, Align, Align2, Color32, Context, CursorIcon, Event, EventFilter, FontSelection, Id,
|
||||
ImeEvent, Key, KeyboardShortcut, Margin, Modifiers, NumExt, Response, Sense, Shape, TextBuffer,
|
||||
TextStyle, TextWrapMode, Ui, Vec2, Widget, WidgetInfo, WidgetText, WidgetWithState,
|
||||
ImeEvent, Key, KeyboardShortcut, Margin, Modifiers, NumExt as _, Response, Sense, Shape,
|
||||
TextBuffer, TextStyle, TextWrapMode, Ui, Vec2, Widget, WidgetInfo, WidgetText, WidgetWithState,
|
||||
};
|
||||
|
||||
use super::{TextEditOutput, TextEditState};
|
||||
|
|
@ -878,7 +878,7 @@ fn mask_if_password(is_password: bool, text: &str) -> String {
|
|||
// ----------------------------------------------------------------------------
|
||||
|
||||
/// Check for (keyboard) events to edit the cursor and/or text.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
fn events(
|
||||
ui: &crate::Ui,
|
||||
state: &mut TextEditState,
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ impl TextEditState {
|
|||
self.undoer.lock().clone()
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_pass_by_ref_mut)] // Intentionally hide interiority of mutability
|
||||
#[expect(clippy::needless_pass_by_ref_mut)] // Intentionally hide interiority of mutability
|
||||
pub fn set_undoer(&mut self, undoer: TextEditUndoer) {
|
||||
*self.undoer.lock() = undoer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ struct RotatingTriangle {
|
|||
vertex_array: glow::VertexArray,
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)] // we need unsafe code to use glow
|
||||
#[expect(unsafe_code)] // we need unsafe code to use glow
|
||||
impl RotatingTriangle {
|
||||
fn new(gl: &glow::Context) -> Option<Self> {
|
||||
use glow::HasContext as _;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use std::num::NonZeroU64;
|
||||
|
||||
use eframe::{
|
||||
egui_wgpu::wgpu::util::DeviceExt,
|
||||
egui_wgpu::wgpu::util::DeviceExt as _,
|
||||
egui_wgpu::{self, wgpu},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ impl BackendPanel {
|
|||
if cfg!(debug_assertions) && cfg!(target_arch = "wasm32") {
|
||||
ui.separator();
|
||||
// For testing panic handling on web:
|
||||
#[allow(clippy::manual_assert)]
|
||||
#[expect(clippy::manual_assert)]
|
||||
if ui.button("panic!()").clicked() {
|
||||
panic!("intentional panic!");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ pub use wrap_app::{Anchor, WrapApp};
|
|||
|
||||
/// Time of day as seconds since midnight. Used for clock in demo app.
|
||||
pub(crate) fn seconds_since_midnight() -> f64 {
|
||||
use chrono::Timelike;
|
||||
use chrono::Timelike as _;
|
||||
let time = chrono::Local::now().time();
|
||||
time.num_seconds_from_midnight() as f64 + 1e-9 * (time.nanosecond() as f64)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ fn start_puffin_server() {
|
|||
|
||||
// We can store the server if we want, but in this case we just want
|
||||
// it to keep running. Dropping it closes the server, so let's not drop it!
|
||||
#[allow(clippy::mem_forget)]
|
||||
#[expect(clippy::mem_forget)]
|
||||
std::mem::forget(puffin_server);
|
||||
}
|
||||
Err(err) => {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ pub struct WebHandle {
|
|||
#[wasm_bindgen]
|
||||
impl WebHandle {
|
||||
/// Installs a panic hook, then returns.
|
||||
#[allow(clippy::new_without_default)]
|
||||
#[allow(clippy::new_without_default, clippy::allow_attributes)]
|
||||
#[wasm_bindgen(constructor)]
|
||||
pub fn new() -> Self {
|
||||
// Redirect [`log`] message to `console.log` and friends:
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ impl WrapApp {
|
|||
// This gives us image support:
|
||||
egui_extras::install_image_loaders(&cc.egui_ctx);
|
||||
|
||||
#[allow(unused_mut)]
|
||||
#[allow(unused_mut, clippy::allow_attributes)]
|
||||
let mut slf = Self {
|
||||
state: State::default(),
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use egui::accesskit::Role;
|
||||
use egui::Vec2;
|
||||
use egui_demo_app::{Anchor, WrapApp};
|
||||
use egui_kittest::kittest::Queryable;
|
||||
use egui_kittest::kittest::Queryable as _;
|
||||
use egui_kittest::SnapshotResults;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ impl crate::Demo for CodeExample {
|
|||
}
|
||||
|
||||
fn show(&mut self, ctx: &egui::Context, open: &mut bool) {
|
||||
use crate::View;
|
||||
use crate::View as _;
|
||||
egui::Window::new(self.name())
|
||||
.open(open)
|
||||
.min_width(375.0)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use std::collections::BTreeSet;
|
|||
use super::About;
|
||||
use crate::is_mobile;
|
||||
use crate::Demo;
|
||||
use crate::View;
|
||||
use crate::View as _;
|
||||
use egui::containers::menu;
|
||||
use egui::style::StyleModifier;
|
||||
use egui::{Context, Modifiers, ScrollArea, Ui};
|
||||
|
|
@ -359,9 +359,9 @@ fn file_menu_button(ui: &mut Ui) {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::{demo::demo_app_windows::DemoGroups, Demo};
|
||||
use crate::{demo::demo_app_windows::DemoGroups, Demo as _};
|
||||
use egui::Vec2;
|
||||
use egui_kittest::kittest::Queryable;
|
||||
use egui_kittest::kittest::Queryable as _;
|
||||
use egui_kittest::{Harness, SnapshotOptions, SnapshotResults};
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ fn char_name(chr: char) -> String {
|
|||
}
|
||||
|
||||
fn special_char_name(chr: char) -> Option<&'static str> {
|
||||
#[allow(clippy::match_same_arms)] // many "flag"
|
||||
#[expect(clippy::match_same_arms)] // many "flag"
|
||||
match chr {
|
||||
// Special private-use-area extensions found in `emoji-icon-font.ttf`:
|
||||
// Private use area extensions:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use egui::{Frame, Label, RichText, Sense, UiBuilder, Widget};
|
||||
use egui::{Frame, Label, RichText, Sense, UiBuilder, Widget as _};
|
||||
|
||||
/// Showcase [`egui::Ui::response`].
|
||||
#[derive(PartialEq, Eq, Default)]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use egui::{ComboBox, Context, Id, Modal, ProgressBar, Ui, Widget, Window};
|
||||
use egui::{ComboBox, Context, Id, Modal, ProgressBar, Ui, Widget as _, Window};
|
||||
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
|
|
@ -163,10 +163,10 @@ impl crate::View for Modals {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::demo::modals::Modals;
|
||||
use crate::Demo;
|
||||
use crate::Demo as _;
|
||||
use egui::accesskit::Role;
|
||||
use egui::Key;
|
||||
use egui_kittest::kittest::Queryable;
|
||||
use egui_kittest::kittest::Queryable as _;
|
||||
use egui_kittest::{Harness, SnapshotResults};
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use egui::{
|
|||
emath,
|
||||
epaint::{self, CubicBezierShape, PathShape, QuadraticBezierShape},
|
||||
pos2, Color32, Context, Frame, Grid, Pos2, Rect, Sense, Shape, Stroke, StrokeKind, Ui, Vec2,
|
||||
Widget, Window,
|
||||
Widget as _, Window,
|
||||
};
|
||||
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
/// ``` ignore
|
||||
/// password_ui(ui, &mut my_password);
|
||||
/// ```
|
||||
#[allow(clippy::ptr_arg)] // false positive
|
||||
pub fn password_ui(ui: &mut egui::Ui, password: &mut String) -> egui::Response {
|
||||
// This widget has its own state — show or hide password characters (`show_plaintext`).
|
||||
// In this case we use a simple `bool`, but you can also declare your own type.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use egui::{Image, UserData, ViewportCommand, Widget};
|
||||
use egui::{Image, UserData, ViewportCommand, Widget as _};
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Showcase [`ViewportCommand::Screenshot`].
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use egui::{
|
||||
pos2, scroll_area::ScrollBarVisibility, Align, Align2, Color32, DragValue, NumExt, Rect,
|
||||
ScrollArea, Sense, Slider, TextStyle, TextWrapMode, Ui, Vec2, Widget,
|
||||
pos2, scroll_area::ScrollBarVisibility, Align, Align2, Color32, DragValue, NumExt as _, Rect,
|
||||
ScrollArea, Sense, Slider, TextStyle, TextWrapMode, Ui, Vec2, Widget as _,
|
||||
};
|
||||
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use egui::{
|
||||
emath::{GuiRounding, TSTransform},
|
||||
emath::{GuiRounding as _, TSTransform},
|
||||
epaint::{self, RectShape},
|
||||
vec2, Color32, Pos2, Rect, Sense, StrokeKind, Vec2,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ impl crate::View for TextEditDemo {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use egui::{accesskit, CentralPanel};
|
||||
use egui_kittest::kittest::{Key, Queryable};
|
||||
use egui_kittest::kittest::{Key, Queryable as _};
|
||||
use egui_kittest::Harness;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ pub fn toggle_ui(ui: &mut egui::Ui, on: &mut bool) -> egui::Response {
|
|||
}
|
||||
|
||||
/// Here is the same code again, but a bit more compact:
|
||||
#[allow(dead_code)]
|
||||
#[expect(dead_code)]
|
||||
fn toggle_ui_compact(ui: &mut egui::Ui, on: &mut bool) -> egui::Response {
|
||||
let desired_size = ui.spacing().interact_size.y * egui::vec2(2.0, 1.0);
|
||||
let (rect, mut response) = ui.allocate_exact_size(desired_size, egui::Sense::click());
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ impl Default for WidgetGallery {
|
|||
}
|
||||
|
||||
impl WidgetGallery {
|
||||
#[allow(unused_mut)] // if not chrono
|
||||
#[allow(unused_mut, clippy::allow_attributes)] // if not chrono
|
||||
#[inline]
|
||||
pub fn with_date_button(mut self, _with_date_button: bool) -> Self {
|
||||
#[cfg(feature = "chrono")]
|
||||
|
|
@ -308,7 +308,7 @@ fn doc_link_label_with_crate<'a>(
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::View;
|
||||
use crate::View as _;
|
||||
use egui::Vec2;
|
||||
use egui_kittest::Harness;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ mod button;
|
|||
mod popup;
|
||||
|
||||
pub use button::DatePickerButton;
|
||||
use chrono::{Datelike, Duration, NaiveDate, Weekday};
|
||||
use chrono::{Datelike as _, Duration, NaiveDate, Weekday};
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Week {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use chrono::{Datelike, NaiveDate, Weekday};
|
||||
use chrono::{Datelike as _, NaiveDate, Weekday};
|
||||
|
||||
use egui::{Align, Button, Color32, ComboBox, Direction, Id, Layout, RichText, Ui, Vec2};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use egui::{emath::GuiRounding, Id, Pos2, Rect, Response, Sense, Ui, UiBuilder};
|
||||
use egui::{emath::GuiRounding as _, Id, Pos2, Rect, Response, Sense, Ui, UiBuilder};
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub(crate) enum CellSize {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ mod table;
|
|||
pub use crate::datepicker::DatePickerButton;
|
||||
|
||||
#[doc(hidden)]
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
pub use crate::image::RetainedImage;
|
||||
pub(crate) use crate::layout::StripLayout;
|
||||
pub use crate::sizing::Size;
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ impl ImageLoader for ImageCrateLoader {
|
|||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[allow(clippy::unnecessary_wraps)] // needed here to match other return types
|
||||
#[expect(clippy::unnecessary_wraps)] // needed here to match other return types
|
||||
fn load_image(
|
||||
ctx: &egui::Context,
|
||||
uri: &str,
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ fn is_supported(uri: &str) -> bool {
|
|||
impl Default for SvgLoader {
|
||||
fn default() -> Self {
|
||||
// opt is mutated when `svg_text` feature flag is enabled
|
||||
#[allow(unused_mut)]
|
||||
#[allow(unused_mut, clippy::allow_attributes)]
|
||||
let mut options = resvg::usvg::Options::default();
|
||||
|
||||
#[cfg(feature = "svg_text")]
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use egui::{
|
|||
mutex::Mutex,
|
||||
ColorImage, FrameDurations, Id,
|
||||
};
|
||||
use image::{codecs::webp::WebPDecoder, AnimationDecoder as _, ColorType, ImageDecoder, Rgba};
|
||||
use image::{codecs::webp::WebPDecoder, AnimationDecoder as _, ColorType, ImageDecoder as _, Rgba};
|
||||
use std::{io::Cursor, mem::size_of, sync::Arc, time::Duration};
|
||||
|
||||
#[derive(Clone)]
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ pub fn highlight(
|
|||
// performing it at a separate thread (ctx, ctx.style()) can be used and when ui is available
|
||||
// (ui.ctx(), ui.style()) can be used
|
||||
|
||||
#[allow(non_local_definitions)]
|
||||
#[expect(non_local_definitions)]
|
||||
impl egui::cache::ComputerMut<(&egui::FontId, &CodeTheme, &str, &str), LayoutJob> for Highlighter {
|
||||
fn compute(
|
||||
&mut self,
|
||||
|
|
@ -285,7 +285,7 @@ impl CodeTheme {
|
|||
impl CodeTheme {
|
||||
// The syntect version takes it by value. This could be avoided by specializing the from_style
|
||||
// function, but at the cost of more code duplication.
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
fn dark_with_font_id(font_id: egui::FontId) -> Self {
|
||||
use egui::{Color32, TextFormat};
|
||||
Self {
|
||||
|
|
@ -302,7 +302,7 @@ impl CodeTheme {
|
|||
}
|
||||
|
||||
// The syntect version takes it by value
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
fn light_with_font_id(font_id: egui::FontId) -> Self {
|
||||
use egui::{Color32, TextFormat};
|
||||
Self {
|
||||
|
|
@ -413,7 +413,6 @@ impl Default for Highlighter {
|
|||
}
|
||||
|
||||
impl Highlighter {
|
||||
#[allow(clippy::unused_self, clippy::unnecessary_wraps)]
|
||||
fn highlight(
|
||||
&self,
|
||||
font_id: egui::FontId,
|
||||
|
|
@ -512,7 +511,7 @@ struct Highlighter {}
|
|||
|
||||
#[cfg(not(feature = "syntect"))]
|
||||
impl Highlighter {
|
||||
#[allow(clippy::unused_self, clippy::unnecessary_wraps)]
|
||||
#[expect(clippy::unused_self, clippy::unnecessary_wraps)]
|
||||
fn highlight_impl(
|
||||
&self,
|
||||
theme: &CodeTheme,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use std::num::NonZeroU32;
|
|||
use std::sync::Arc;
|
||||
|
||||
use egui_winit::winit;
|
||||
use winit::raw_window_handle::HasWindowHandle;
|
||||
use winit::raw_window_handle::HasWindowHandle as _;
|
||||
|
||||
/// The majority of `GlutinWindowContext` is taken from `eframe`
|
||||
struct GlutinWindowContext {
|
||||
|
|
@ -22,12 +22,12 @@ struct GlutinWindowContext {
|
|||
impl GlutinWindowContext {
|
||||
// refactor this function to use `glutin-winit` crate eventually.
|
||||
// preferably add android support at the same time.
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
unsafe fn new(event_loop: &winit::event_loop::ActiveEventLoop) -> Self {
|
||||
use glutin::context::NotCurrentGlContext;
|
||||
use glutin::display::GetGlDisplay;
|
||||
use glutin::display::GlDisplay;
|
||||
use glutin::prelude::GlSurface;
|
||||
use glutin::context::NotCurrentGlContext as _;
|
||||
use glutin::display::GetGlDisplay as _;
|
||||
use glutin::display::GlDisplay as _;
|
||||
use glutin::prelude::GlSurface as _;
|
||||
let winit_window_builder = winit::window::WindowAttributes::default()
|
||||
.with_resizable(true)
|
||||
.with_inner_size(winit::dpi::LogicalSize {
|
||||
|
|
@ -138,7 +138,7 @@ impl GlutinWindowContext {
|
|||
}
|
||||
|
||||
fn resize(&self, physical_size: winit::dpi::PhysicalSize<u32>) {
|
||||
use glutin::surface::GlSurface;
|
||||
use glutin::surface::GlSurface as _;
|
||||
self.gl_surface.resize(
|
||||
&self.gl_context,
|
||||
physical_size.width.try_into().unwrap(),
|
||||
|
|
@ -147,12 +147,12 @@ impl GlutinWindowContext {
|
|||
}
|
||||
|
||||
fn swap_buffers(&self) -> glutin::error::Result<()> {
|
||||
use glutin::surface::GlSurface;
|
||||
use glutin::surface::GlSurface as _;
|
||||
self.gl_surface.swap_buffers(&self.gl_context)
|
||||
}
|
||||
|
||||
fn get_proc_address(&self, addr: &std::ffi::CStr) -> *const std::ffi::c_void {
|
||||
use glutin::display::GlDisplay;
|
||||
use glutin::display::GlDisplay as _;
|
||||
self.gl_display.get_proc_address(addr)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ macro_rules! check_for_gl_error_even_in_release {
|
|||
#[doc(hidden)]
|
||||
pub fn check_for_gl_error_impl(gl: &glow::Context, file: &str, line: u32, context: &str) {
|
||||
use glow::HasContext as _;
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
let error_code = unsafe { gl.get_error() };
|
||||
if error_code != glow::NO_ERROR {
|
||||
let error_str = match error_code {
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue