mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 14:49:06 -04:00
Replace #[allow attributes with expect (#7796)
We do have `clippy::allow_attributes` turned on, but it doesn't seem to work properly
This commit is contained in:
@@ -41,7 +41,7 @@ impl Hsva {
|
||||
/// From linear RGBA with premultiplied alpha
|
||||
#[inline]
|
||||
pub fn from_rgba_premultiplied(r: f32, g: f32, b: f32, a: f32) -> Self {
|
||||
#![allow(clippy::many_single_char_names)]
|
||||
#![expect(clippy::many_single_char_names)]
|
||||
if a <= 0.0 {
|
||||
if r == 0.0 && b == 0.0 && a == 0.0 {
|
||||
Self::default()
|
||||
@@ -57,7 +57,7 @@ impl Hsva {
|
||||
/// From linear RGBA without premultiplied alpha
|
||||
#[inline]
|
||||
pub fn from_rgba_unmultiplied(r: f32, g: f32, b: f32, a: f32) -> Self {
|
||||
#![allow(clippy::many_single_char_names)]
|
||||
#![expect(clippy::many_single_char_names)]
|
||||
let (h, s, v) = hsv_from_rgb([r, g, b]);
|
||||
Self { h, s, v, a }
|
||||
}
|
||||
@@ -189,7 +189,7 @@ impl From<Color32> for Hsva {
|
||||
/// All ranges in 0-1, rgb is linear.
|
||||
#[inline]
|
||||
pub fn hsv_from_rgb([r, g, b]: [f32; 3]) -> (f32, f32, f32) {
|
||||
#![allow(clippy::many_single_char_names)]
|
||||
#![expect(clippy::many_single_char_names)]
|
||||
let min = r.min(g.min(b));
|
||||
let max = r.max(g.max(b)); // value
|
||||
|
||||
@@ -213,7 +213,7 @@ pub fn hsv_from_rgb([r, g, b]: [f32; 3]) -> (f32, f32, f32) {
|
||||
/// All ranges in 0-1, rgb is linear.
|
||||
#[inline]
|
||||
pub fn rgb_from_hsv((h, s, v): (f32, f32, f32)) -> [f32; 3] {
|
||||
#![allow(clippy::many_single_char_names)]
|
||||
#![expect(clippy::many_single_char_names)]
|
||||
let h = (h.fract() + 1.0).fract(); // wrap
|
||||
let s = s.clamp(0.0, 1.0);
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#![cfg_attr(feature = "document-features", doc = document_features::document_features!())]
|
||||
//!
|
||||
|
||||
#![allow(clippy::wrong_self_convention)]
|
||||
#![expect(clippy::wrong_self_convention)]
|
||||
|
||||
#[cfg(feature = "cint")]
|
||||
mod cint_impl;
|
||||
|
||||
@@ -142,7 +142,6 @@
|
||||
//!
|
||||
|
||||
#![warn(missing_docs)] // let's keep eframe well-documented
|
||||
#![allow(clippy::needless_doctest_main)]
|
||||
|
||||
// Limitation imposed by `accesskit_winit`:
|
||||
// https://github.com/AccessKit/accesskit/tree/accesskit-v0.18.0/platforms/winit#android-activity-compatibility`
|
||||
@@ -253,7 +252,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_no_default_features"))]
|
||||
#[allow(clippy::needless_pass_by_value, clippy::allow_attributes)]
|
||||
#[allow(clippy::allow_attributes, clippy::needless_pass_by_value)]
|
||||
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, clippy::allow_attributes)] // Not used on Linux
|
||||
#[allow(clippy::allow_attributes, dead_code)] // Not used on Linux
|
||||
Set,
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ 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, clippy::allow_attributes)]
|
||||
#[allow(clippy::allow_attributes, unreachable_code)]
|
||||
AppIconStatus::NotSetIgnored
|
||||
}
|
||||
|
||||
|
||||
@@ -349,8 +349,6 @@ pub fn run_glow(
|
||||
mut native_options: epi::NativeOptions,
|
||||
app_creator: epi::AppCreator<'_>,
|
||||
) -> Result {
|
||||
#![allow(clippy::needless_return_with_question_mark)] // False positive
|
||||
|
||||
use super::glow_integration::GlowWinitApp;
|
||||
|
||||
#[cfg(not(target_os = "ios"))]
|
||||
@@ -387,8 +385,6 @@ pub fn run_wgpu(
|
||||
mut native_options: epi::NativeOptions,
|
||||
app_creator: epi::AppCreator<'_>,
|
||||
) -> Result {
|
||||
#![allow(clippy::needless_return_with_question_mark)] // False positive
|
||||
|
||||
use super::wgpu_integration::WgpuWinitApp;
|
||||
|
||||
#[cfg(not(target_os = "ios"))]
|
||||
|
||||
@@ -256,7 +256,7 @@ impl<'app> WgpuWinitApp<'app> {
|
||||
});
|
||||
}
|
||||
|
||||
#[allow(unused_mut, clippy::allow_attributes)] // used for accesskit
|
||||
#[allow(clippy::allow_attributes, unused_mut)] // used for accesskit
|
||||
let mut egui_winit = egui_winit::State::new(
|
||||
egui_ctx.clone(),
|
||||
ViewportId::ROOT,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#![allow(dead_code)] // not everything is used on wasm
|
||||
#![allow(clippy::allow_attributes, dead_code)] // not used on all platforms
|
||||
|
||||
use web_time::Instant;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::{App, epi, web::web_painter::WebPainter};
|
||||
use super::{NeedRepaint, now_sec, text_agent::TextAgent};
|
||||
|
||||
pub struct AppRunner {
|
||||
#[allow(dead_code, clippy::allow_attributes)]
|
||||
#[allow(clippy::allow_attributes, dead_code)]
|
||||
pub(crate) web_options: crate::WebOptions,
|
||||
pub(crate) frame: epi::Frame,
|
||||
egui_ctx: egui::Context,
|
||||
|
||||
@@ -38,7 +38,7 @@ impl log::Log for WebLogger {
|
||||
}
|
||||
|
||||
fn log(&self, record: &log::Record<'_>) {
|
||||
#![allow(clippy::match_same_arms)]
|
||||
#![expect(clippy::match_same_arms)]
|
||||
|
||||
if !self.enabled(record.metadata()) {
|
||||
return;
|
||||
@@ -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, clippy::allow_attributes)] // only used on web and in tests
|
||||
#[allow(clippy::allow_attributes, dead_code)] // 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('/') {
|
||||
|
||||
@@ -28,7 +28,7 @@ impl WebPainterGlow {
|
||||
let (gl, shader_prefix) =
|
||||
init_glow_context_from_canvas(&canvas, options.webgl_context_option)?;
|
||||
|
||||
#[allow(clippy::arc_with_non_send_sync, clippy::allow_attributes)] // For wasm
|
||||
#[allow(clippy::allow_attributes, clippy::arc_with_non_send_sync)] // For wasm
|
||||
let gl = std::sync::Arc::new(gl);
|
||||
|
||||
let painter = egui_glow::Painter::new(gl, shader_prefix, None, options.dithering)
|
||||
|
||||
@@ -126,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, clippy::allow_attributes)] // For wasm
|
||||
#[allow(clippy::allow_attributes, clippy::arc_with_non_send_sync)] // 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,
|
||||
@@ -186,7 +186,7 @@ impl CaptureState {
|
||||
tx: CaptureSender,
|
||||
viewport_id: ViewportId,
|
||||
) {
|
||||
#[allow(clippy::arc_with_non_send_sync, clippy::allow_attributes)] // For wasm
|
||||
#[allow(clippy::allow_attributes, clippy::arc_with_non_send_sync)] // For wasm
|
||||
let buffer = Arc::new(buffer);
|
||||
let buffer_clone = Arc::clone(&buffer);
|
||||
let buffer_slice = buffer_clone.slice(..);
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
#![doc = document_features::document_features!()]
|
||||
//!
|
||||
|
||||
#![allow(unsafe_code)]
|
||||
|
||||
pub use wgpu;
|
||||
|
||||
/// Low-level painting of [`egui`](https://github.com/emilk/egui) on [`wgpu`].
|
||||
@@ -247,7 +245,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, clippy::allow_attributes)] // For wasm
|
||||
#[allow(clippy::allow_attributes, clippy::arc_with_non_send_sync)] // For wasm
|
||||
Ok(Self {
|
||||
adapter,
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
|
||||
@@ -48,7 +48,7 @@ impl WgpuSetup {
|
||||
pub async fn new_instance(&self) -> wgpu::Instance {
|
||||
match self {
|
||||
Self::CreateNew(create_new) => {
|
||||
#[allow(unused_mut, clippy::allow_attributes)]
|
||||
#[allow(clippy::allow_attributes, unused_mut)]
|
||||
let mut backends = create_new.instance_descriptor.backends;
|
||||
|
||||
// Don't try WebGPU if we're not in a secure context.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#![expect(clippy::missing_errors_doc)]
|
||||
#![expect(clippy::undocumented_unsafe_blocks)]
|
||||
#![expect(clippy::unwrap_used)] // TODO(emilk): avoid unwraps
|
||||
#![expect(unsafe_code)]
|
||||
|
||||
use crate::{RenderState, SurfaceErrorAction, WgpuConfiguration, renderer};
|
||||
use crate::{
|
||||
|
||||
@@ -175,7 +175,7 @@ fn init_arboard() -> Option<arboard::Clipboard> {
|
||||
fn init_smithay_clipboard(
|
||||
raw_display_handle: Option<RawDisplayHandle>,
|
||||
) -> Option<smithay_clipboard::Clipboard> {
|
||||
#![allow(clippy::undocumented_unsafe_blocks)]
|
||||
#![expect(clippy::undocumented_unsafe_blocks)]
|
||||
|
||||
profiling::function_scope!();
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#![cfg_attr(feature = "document-features", doc = document_features::document_features!())]
|
||||
//!
|
||||
|
||||
#![allow(clippy::manual_range_contains)]
|
||||
#![expect(clippy::manual_range_contains)]
|
||||
|
||||
#[cfg(feature = "accesskit")]
|
||||
pub use accesskit_winit;
|
||||
|
||||
@@ -25,7 +25,7 @@ mod ios {
|
||||
|
||||
let app = UIApplication::sharedApplication(main_thread_marker);
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code)]
|
||||
unsafe {
|
||||
// Look for the first window scene that's in the foreground
|
||||
for scene in app.connectedScenes() {
|
||||
|
||||
@@ -198,8 +198,7 @@ macro_rules! all_the_atoms {
|
||||
$($T: IntoAtoms<'a>),*
|
||||
{
|
||||
fn collect(self, _atoms: &mut Atoms<'a>) {
|
||||
#[allow(clippy::allow_attributes)]
|
||||
#[allow(non_snake_case)]
|
||||
#[allow(clippy::allow_attributes, non_snake_case)]
|
||||
let ($($T),*) = self;
|
||||
$($T.collect(_atoms);)*
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//! Old and deprecated API for popups. Use [`Popup`] instead.
|
||||
#![allow(deprecated)]
|
||||
#![expect(deprecated)]
|
||||
|
||||
use crate::containers::tooltip::Tooltip;
|
||||
use crate::{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! See [`ScrollArea`] for docs.
|
||||
|
||||
#![allow(clippy::needless_range_loop)]
|
||||
#![expect(clippy::needless_range_loop)]
|
||||
|
||||
use std::ops::{Add, AddAssign, BitOr, BitOrAssign};
|
||||
|
||||
|
||||
@@ -1254,7 +1254,7 @@ impl Context {
|
||||
self.check_for_id_clash(w.id, w.rect, "widget");
|
||||
}
|
||||
|
||||
#[allow(clippy::let_and_return, clippy::allow_attributes)]
|
||||
#[allow(clippy::allow_attributes, clippy::let_and_return)]
|
||||
let res = self.get_response(w);
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
|
||||
@@ -201,7 +201,7 @@ fn contains_circle(interact_rect: emath::Rect, pos: Pos2, radius: f32) -> bool {
|
||||
}
|
||||
|
||||
fn hit_test_on_close(close: &[WidgetRect], pos: Pos2) -> WidgetHits {
|
||||
#![allow(clippy::collapsible_else_if)]
|
||||
#![expect(clippy::collapsible_else_if)]
|
||||
|
||||
// First find the best direct hits:
|
||||
let hit_click = find_closest_within(
|
||||
|
||||
@@ -385,8 +385,8 @@
|
||||
//! egui apps can run significantly (~20%) faster by using a custom allocator, like [mimalloc](https://crates.io/crates/mimalloc) or [talc](https://crates.io/crates/talc).
|
||||
//!
|
||||
|
||||
#![allow(clippy::float_cmp)]
|
||||
#![allow(clippy::manual_range_contains)]
|
||||
#![expect(clippy::float_cmp)]
|
||||
#![expect(clippy::manual_range_contains)]
|
||||
|
||||
mod animation_manager;
|
||||
mod atomics;
|
||||
|
||||
@@ -39,7 +39,7 @@ impl Theme {
|
||||
/// This is not the best design as it doesn't allow switching back to "follow system".
|
||||
#[must_use]
|
||||
pub(crate) fn small_toggle_button(self, ui: &mut crate::Ui) -> Option<Self> {
|
||||
#![allow(clippy::collapsible_else_if)]
|
||||
#![expect(clippy::collapsible_else_if)]
|
||||
if self == Self::Dark {
|
||||
if ui
|
||||
.add(Button::new("☀").frame(false))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#![allow(deprecated)]
|
||||
#![expect(deprecated)]
|
||||
//! Deprecated menu API - Use [`crate::containers::menu`] instead.
|
||||
//!
|
||||
//! Usage:
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
//! egui theme (spacing, colors, etc).
|
||||
|
||||
#![allow(clippy::if_same_then_else)]
|
||||
|
||||
use emath::Align;
|
||||
use epaint::{AlphaFromCoverage, CornerRadius, Shadow, Stroke, TextOptions, text::FontTweak};
|
||||
use std::{collections::BTreeMap, ops::RangeInclusive, sync::Arc};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![warn(missing_docs)] // Let's keep `Ui` well-documented.
|
||||
#![allow(clippy::use_self)]
|
||||
#![expect(clippy::use_self)]
|
||||
|
||||
use std::{any::Any, hash::Hash, ops::Deref, sync::Arc};
|
||||
|
||||
|
||||
@@ -484,7 +484,7 @@ impl IdTypeMap {
|
||||
|
||||
/// For tests
|
||||
#[cfg(feature = "persistence")]
|
||||
#[allow(unused, clippy::allow_attributes)]
|
||||
#[allow(clippy::allow_attributes, unused)]
|
||||
fn get_generation<T: SerializableAny>(&self, id: Id) -> Option<usize> {
|
||||
let element = self.map.get(&hash(TypeId::of::<T>(), id))?;
|
||||
match element {
|
||||
@@ -724,7 +724,7 @@ fn test_two_id_two_type() {
|
||||
|
||||
#[test]
|
||||
fn test_two_id_x_two_types() {
|
||||
#![allow(clippy::approx_constant)]
|
||||
#![expect(clippy::approx_constant)]
|
||||
|
||||
let a = Id::new("a");
|
||||
let b = Id::new("b");
|
||||
|
||||
@@ -114,7 +114,7 @@ fn color_button(ui: &mut Ui, color: Color32, open: bool) -> Response {
|
||||
}
|
||||
|
||||
fn color_slider_1d(ui: &mut Ui, value: &mut f32, color_at: impl Fn(f32) -> Color32) -> Response {
|
||||
#![allow(clippy::identity_op)]
|
||||
#![expect(clippy::identity_op)]
|
||||
|
||||
let desired_size = vec2(ui.spacing().slider_width, ui.spacing().interact_size.y);
|
||||
let (rect, response) = ui.allocate_at_least(desired_size, Sense::click_and_drag());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#![allow(clippy::needless_pass_by_value)] // False positives with `impl ToString`
|
||||
#![expect(clippy::needless_pass_by_value)] // False positives with `impl ToString`
|
||||
|
||||
use std::{cmp::Ordering, ops::RangeInclusive};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#![allow(clippy::needless_pass_by_value)] // False positives with `impl ToString`
|
||||
#![expect(clippy::needless_pass_by_value)] // False positives with `impl ToString`
|
||||
|
||||
use std::ops::RangeInclusive;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#![allow(clippy::undocumented_unsafe_blocks)]
|
||||
#![expect(clippy::undocumented_unsafe_blocks)]
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
//! Demo app for egui
|
||||
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
#![allow(clippy::never_loop)] // False positive
|
||||
#![expect(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
#![allow(clippy::allow_attributes, clippy::never_loop)]
|
||||
|
||||
#[global_allocator]
|
||||
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; // Much faster allocator, can give 20% speedups: https://github.com/emilk/egui/pull/7029
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#![allow(clippy::mem_forget)] // False positives from #[wasm_bindgen] macro
|
||||
|
||||
use eframe::wasm_bindgen::{self, prelude::*};
|
||||
|
||||
use crate::WrapApp;
|
||||
@@ -14,7 +12,7 @@ pub struct WebHandle {
|
||||
#[wasm_bindgen]
|
||||
impl WebHandle {
|
||||
/// Installs a panic hook, then returns.
|
||||
#[allow(clippy::new_without_default, clippy::allow_attributes)]
|
||||
#[allow(clippy::allow_attributes, clippy::new_without_default)]
|
||||
#[wasm_bindgen(constructor)]
|
||||
pub fn new() -> Self {
|
||||
// Redirect [`log`] message to `console.log` and friends:
|
||||
|
||||
@@ -183,7 +183,7 @@ impl WrapApp {
|
||||
cc.egui_ctx
|
||||
.add_plugin(crate::accessibility_inspector::AccessibilityInspectorPlugin::default());
|
||||
|
||||
#[allow(unused_mut, clippy::allow_attributes)]
|
||||
#[allow(clippy::allow_attributes, unused_mut)]
|
||||
let mut slf = Self {
|
||||
state: State::default(),
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ impl Default for WidgetGallery {
|
||||
}
|
||||
|
||||
impl WidgetGallery {
|
||||
#[allow(unused_mut, clippy::allow_attributes)] // if not chrono
|
||||
#[allow(clippy::allow_attributes, unused_mut)] // if not chrono
|
||||
#[inline]
|
||||
pub fn with_date_button(mut self, _with_date_button: bool) -> Self {
|
||||
#[cfg(feature = "chrono")]
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
#![cfg_attr(feature = "document-features", doc = document_features::document_features!())]
|
||||
//!
|
||||
|
||||
#![allow(clippy::float_cmp)]
|
||||
#![allow(clippy::manual_range_contains)]
|
||||
#![expect(clippy::manual_range_contains)]
|
||||
|
||||
#[cfg(feature = "chrono")]
|
||||
mod datepicker;
|
||||
|
||||
@@ -36,7 +36,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, clippy::allow_attributes)]
|
||||
#[allow(clippy::allow_attributes, unused_mut)]
|
||||
let mut options = resvg::usvg::Options::default();
|
||||
|
||||
#[cfg(feature = "svg_text")]
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
//! Turn on the `syntect` feature for great syntax highlighting of any language.
|
||||
//! Otherwise, a very simple fallback will be used, that works okish for C, C++, Rust, and Python.
|
||||
|
||||
#![allow(clippy::mem_forget)] // False positive from enum_map macro
|
||||
|
||||
use egui::TextStyle;
|
||||
use egui::text::LayoutJob;
|
||||
|
||||
@@ -272,7 +270,7 @@ impl CodeTheme {
|
||||
///
|
||||
/// There is one dark and one light theme stored at any one time.
|
||||
pub fn from_memory(ctx: &egui::Context, style: &egui::Style) -> Self {
|
||||
#![allow(clippy::needless_return)]
|
||||
#![expect(clippy::needless_return)]
|
||||
|
||||
let (id, default) = if style.visuals.dark_mode {
|
||||
(egui::Id::new("dark"), Self::dark as fn(f32) -> Self)
|
||||
@@ -361,6 +359,7 @@ impl CodeTheme {
|
||||
// function, but at the cost of more code duplication.
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
fn dark_with_font_id(font_id: egui::FontId) -> Self {
|
||||
#![expect(clippy::mem_forget)]
|
||||
use egui::{Color32, TextFormat};
|
||||
Self {
|
||||
dark_mode: true,
|
||||
@@ -378,6 +377,7 @@ impl CodeTheme {
|
||||
// The syntect version takes it by value
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
fn light_with_font_id(font_id: egui::FontId) -> Self {
|
||||
#![expect(clippy::mem_forget)]
|
||||
use egui::{Color32, TextFormat};
|
||||
Self {
|
||||
dark_mode: false,
|
||||
|
||||
@@ -656,7 +656,7 @@ impl TableState {
|
||||
}
|
||||
|
||||
fn store(self, ui: &egui::Ui, state_id: egui::Id) {
|
||||
#![allow(clippy::needless_return)]
|
||||
#![expect(clippy::needless_return)]
|
||||
#[cfg(feature = "serde")]
|
||||
{
|
||||
return ui.data_mut(|d| d.insert_persisted(state_id, self));
|
||||
|
||||
@@ -8,9 +8,7 @@
|
||||
#![cfg_attr(feature = "document-features", doc = document_features::document_features!())]
|
||||
//!
|
||||
|
||||
#![allow(clippy::float_cmp)]
|
||||
#![allow(clippy::manual_range_contains)]
|
||||
#![allow(clippy::undocumented_unsafe_blocks)]
|
||||
#![expect(clippy::undocumented_unsafe_blocks)]
|
||||
|
||||
pub mod painter;
|
||||
pub use glow;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#![allow(unsafe_code)]
|
||||
#![expect(unsafe_code)]
|
||||
|
||||
use glow::HasContext as _;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#![allow(clippy::collapsible_else_if)]
|
||||
#![allow(clippy::unwrap_used)]
|
||||
#![allow(unsafe_code)]
|
||||
#![expect(clippy::unwrap_used)]
|
||||
#![expect(unsafe_code)]
|
||||
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#![cfg_attr(feature = "document-features", doc = document_features::document_features!())]
|
||||
//!
|
||||
|
||||
#![allow(clippy::float_cmp)]
|
||||
#![expect(clippy::float_cmp)]
|
||||
|
||||
use std::ops::{Add, Div, Mul, RangeInclusive, Sub};
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ macro_rules! impl_numeric_float {
|
||||
|
||||
#[inline(always)]
|
||||
fn to_f64(self) -> f64 {
|
||||
#[allow(trivial_numeric_casts, clippy::allow_attributes)]
|
||||
#[allow(clippy::allow_attributes, trivial_numeric_casts)]
|
||||
{
|
||||
self as f64
|
||||
}
|
||||
@@ -31,7 +31,7 @@ macro_rules! impl_numeric_float {
|
||||
|
||||
#[inline(always)]
|
||||
fn from_f64(num: f64) -> Self {
|
||||
#[allow(trivial_numeric_casts, clippy::allow_attributes)]
|
||||
#[allow(clippy::allow_attributes, trivial_numeric_casts)]
|
||||
{
|
||||
num as Self
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
#![cfg_attr(feature = "document-features", doc = document_features::document_features!())]
|
||||
//!
|
||||
|
||||
#![allow(clippy::float_cmp)]
|
||||
#![allow(clippy::manual_range_contains)]
|
||||
#![expect(clippy::float_cmp)]
|
||||
#![expect(clippy::manual_range_contains)]
|
||||
|
||||
mod brush;
|
||||
pub mod color;
|
||||
|
||||
@@ -186,7 +186,7 @@ impl std::ops::Div<f32> for Margin {
|
||||
|
||||
#[inline]
|
||||
fn div(self, v: f32) -> Self {
|
||||
#![allow(clippy::suspicious_arithmetic_impl)]
|
||||
#![expect(clippy::suspicious_arithmetic_impl)]
|
||||
self * v.recip()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ impl Mesh {
|
||||
/// Rectangle with a texture and color.
|
||||
#[inline(always)]
|
||||
pub fn add_rect_with_uv(&mut self, rect: Rect, uv: Rect, color: Color32) {
|
||||
#![allow(clippy::identity_op)]
|
||||
#![expect(clippy::identity_op)]
|
||||
let idx = self.vertices.len() as u32;
|
||||
self.indices
|
||||
.extend_from_slice(&[idx + 0, idx + 1, idx + 2, idx + 2, idx + 1, idx + 3]);
|
||||
|
||||
@@ -125,7 +125,7 @@ where
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::disallowed_methods)] // Ok for tests
|
||||
#![expect(clippy::disallowed_methods)] // Ok for tests
|
||||
|
||||
use crate::mutex::Mutex;
|
||||
use std::time::Duration;
|
||||
@@ -158,7 +158,7 @@ mod tests {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[cfg(test)]
|
||||
mod tests_rwlock {
|
||||
#![allow(clippy::disallowed_methods)] // Ok for tests
|
||||
#![expect(clippy::disallowed_methods)] // Ok for tests
|
||||
|
||||
use crate::mutex::RwLock;
|
||||
use std::time::Duration;
|
||||
|
||||
@@ -10,7 +10,7 @@ pub fn adjust_colors(
|
||||
shape: &mut Shape,
|
||||
adjust_color: impl Fn(&mut Color32) + Send + Sync + Copy + 'static,
|
||||
) {
|
||||
#![allow(clippy::match_same_arms)]
|
||||
#![expect(clippy::match_same_arms)]
|
||||
match shape {
|
||||
Shape::Noop => {}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#![allow(clippy::many_single_char_names)]
|
||||
#![allow(clippy::wrong_self_convention)] // False positives
|
||||
#![expect(clippy::many_single_char_names)]
|
||||
|
||||
use std::ops::Range;
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#![allow(clippy::derived_hash_with_manual_eq)] // We need to impl Hash for f32, but we don't implement Eq, which is fine
|
||||
|
||||
use std::{fmt::Debug, sync::Arc};
|
||||
|
||||
use emath::GuiRounding as _;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//! This module converts lines, circles, text and more represented by [`Shape`]
|
||||
//! into textured triangles represented by [`Mesh`].
|
||||
|
||||
#![allow(clippy::identity_op)]
|
||||
#![expect(clippy::identity_op)]
|
||||
|
||||
use emath::{GuiRounding as _, NumExt as _, Pos2, Rect, Rot2, Vec2, pos2, remap, vec2};
|
||||
|
||||
@@ -2207,7 +2207,7 @@ impl Tessellator {
|
||||
///
|
||||
/// ## Returns
|
||||
/// A list of clip rectangles with matching [`Mesh`].
|
||||
#[allow(unused_mut, clippy::allow_attributes)]
|
||||
#[allow(clippy::allow_attributes, unused_mut)]
|
||||
pub fn tessellate_shapes(&mut self, mut shapes: Vec<ClippedShape>) -> Vec<ClippedPrimitive> {
|
||||
profiling::function_scope!();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#![allow(clippy::mem_forget)]
|
||||
#![expect(clippy::mem_forget)]
|
||||
|
||||
use emath::{GuiRounding as _, OrderedFloat, Vec2, vec2};
|
||||
use self_cell::self_cell;
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
#![allow(clippy::derived_hash_with_manual_eq)] // We need to impl Hash for f32, but we don't implement Eq, which is fine
|
||||
#![allow(clippy::wrong_self_convention)] // We use `from_` to indicate conversion direction. It's non-diomatic, but makes sense in this context.
|
||||
|
||||
use std::ops::Range;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
#![expect(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
|
||||
use eframe::egui;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
#![allow(unsafe_code)]
|
||||
#![allow(clippy::undocumented_unsafe_blocks)]
|
||||
#![expect(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
#![expect(unsafe_code)]
|
||||
#![expect(clippy::undocumented_unsafe_blocks)]
|
||||
|
||||
use eframe::{egui, egui_glow, glow};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
#![expect(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
|
||||
use eframe::{
|
||||
egui,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
#![expect(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
|
||||
use eframe::egui;
|
||||
use egui::{FontFamily, FontId, RichText, TextStyle};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
#![expect(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
use eframe::egui;
|
||||
|
||||
mod keypad;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
#![expect(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
|
||||
use eframe::egui::{
|
||||
self, Color32, Stroke, Style, Theme, global_theme_preference_buttons, style::Selection,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
#![expect(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
mod app;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
#![expect(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
|
||||
use eframe::egui;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
#![expect(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
|
||||
use eframe::egui;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
#![expect(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
|
||||
use eframe::egui;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
#![expect(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
|
||||
use eframe::egui;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
#![expect(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
|
||||
use eframe::egui;
|
||||
use egui::{Key, ScrollArea};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
#![expect(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
|
||||
use std::sync::{
|
||||
Arc,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
#![expect(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
|
||||
use eframe::egui::{CentralPanel, ComboBox, Popup, PopupCloseBehavior};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
#![expect(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
|
||||
use std::sync::{
|
||||
Arc,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
#![expect(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
|
||||
use eframe::egui;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
#![expect(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
|
||||
use eframe::{CreationContext, NativeOptions, egui};
|
||||
use egui::{Button, CentralPanel, UserAttentionType};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
#![allow(rustdoc::missing_crate_level_docs)] // it's a test
|
||||
#![expect(rustdoc::missing_crate_level_docs)] // it's a test
|
||||
|
||||
use eframe::egui;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
#![expect(rustdoc::missing_crate_level_docs)] // it's an example
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
//! Helper crate for running scripts within the `egui` repo
|
||||
|
||||
#![allow(clippy::print_stdout)]
|
||||
#![allow(clippy::print_stderr)]
|
||||
#![expect(clippy::print_stderr, clippy::print_stdout)]
|
||||
#![allow(clippy::exit)]
|
||||
|
||||
mod deny;
|
||||
|
||||
Reference in New Issue
Block a user