mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user