1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 04:40: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

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

View File

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

View File

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

View File

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