1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 22:30:03 -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:
Emil Ernerfeldt
2025-12-19 20:55:50 +01:00
committed by GitHub
parent 7fe58bbfd4
commit 8d98763fe1
75 changed files with 89 additions and 111 deletions

View File

@@ -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);)*
}

View File

@@ -1,5 +1,5 @@
//! Old and deprecated API for popups. Use [`Popup`] instead.
#![allow(deprecated)]
#![expect(deprecated)]
use crate::containers::tooltip::Tooltip;
use crate::{

View File

@@ -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};

View File

@@ -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)]

View File

@@ -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(

View File

@@ -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;

View File

@@ -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))

View File

@@ -1,4 +1,4 @@
#![allow(deprecated)]
#![expect(deprecated)]
//! Deprecated menu API - Use [`crate::containers::menu`] instead.
//!
//! Usage:

View File

@@ -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};

View File

@@ -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};

View File

@@ -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");

View File

@@ -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());

View File

@@ -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};

View File

@@ -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;