1
0
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:
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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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('/') {

View File

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