Replace cargo check with cargo clippy on ci (#7581)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Emil Ernerfeldt 2025-10-02 20:19:23 +02:00 committed by GitHub
parent 6579bb910b
commit 096ed1c0cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 28 additions and 40 deletions

View File

@ -38,39 +38,26 @@ jobs:
- name: Lint vertical spacing - name: Lint vertical spacing
run: ./scripts/lint.py run: ./scripts/lint.py
- name: check --all-features - run: cargo clippy --locked --all-features --all-targets
run: cargo check --locked --all-features --all-targets
- name: check egui_extras --all-features - run: cargo clippy --locked --all-features -p egui_extras
run: cargo check --locked --all-features -p egui_extras
- name: check default features - run: cargo clippy --locked --all-targets
run: cargo check --locked --all-targets
- name: check --no-default-features - run: cargo clippy --locked --no-default-features --lib --all-targets
run: cargo check --locked --no-default-features --lib --all-targets
- name: check eframe --no-default-features - run: cargo clippy --locked --no-default-features --features x11 --lib -p eframe
run: cargo check --locked --no-default-features --features x11 --lib -p eframe
- name: check egui_extras --no-default-features - run: cargo clippy --locked --no-default-features --lib -p egui_extras
run: cargo check --locked --no-default-features --lib -p egui_extras
- name: check epaint --no-default-features - run: cargo clippy --locked --no-default-features --lib -p epaint
run: cargo check --locked --no-default-features --lib -p epaint
# Regression test for https://github.com/emilk/egui/issues/4771 # Regression test for https://github.com/emilk/egui/issues/4771
- name: cargo check -p test_egui_extras_compilation - run: cargo clippy -p test_egui_extras_compilation
run: cargo check -p test_egui_extras_compilation
- name: cargo doc --lib - run: cargo doc --lib --no-deps --all-features
run: cargo doc --lib --no-deps --all-features
- name: cargo doc --document-private-items - run: cargo doc --document-private-items --no-deps --all-features
run: cargo doc --document-private-items --no-deps --all-features
- name: clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: clippy release - name: clippy release
run: cargo clippy --all-targets --all-features --release -- -D warnings run: cargo clippy --all-targets --all-features --release -- -D warnings
@ -93,14 +80,14 @@ jobs:
- name: Set up cargo cache - name: Set up cargo cache
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
- name: Check wasm32 egui_demo_app - name: clippy wasm32 egui_demo_app
run: cargo check -p egui_demo_app --lib --target wasm32-unknown-unknown run: cargo clippy -p egui_demo_app --lib --target wasm32-unknown-unknown
- name: Check wasm32 egui_demo_app --all-features - name: clippy wasm32 egui_demo_app --all-features
run: cargo check -p egui_demo_app --lib --target wasm32-unknown-unknown --all-features run: cargo clippy -p egui_demo_app --lib --target wasm32-unknown-unknown --all-features
- name: Check wasm32 eframe - name: clippy wasm32 eframe
run: cargo check -p eframe --lib --no-default-features --features glow,persistence --target wasm32-unknown-unknown run: cargo clippy -p eframe --lib --no-default-features --features glow,persistence --target wasm32-unknown-unknown
- name: wasm-bindgen - name: wasm-bindgen
uses: jetli/wasm-bindgen-action@v0.1.0 uses: jetli/wasm-bindgen-action@v0.1.0
@ -222,11 +209,9 @@ jobs:
- name: Set up cargo cache - name: Set up cargo cache
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
- name: Check all - run: cargo clippy --all-targets --all-features
run: cargo check --all-targets --all-features
- name: Check hello_world - run: cargo clippy -p hello_world
run: cargo check -p hello_world
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------

View File

@ -135,7 +135,7 @@ pub fn create_storage(_app_name: &str) -> Option<Box<dyn epi::Storage>> {
None None
} }
#[expect(clippy::unnecessary_wraps)] #[allow(clippy::allow_attributes, clippy::unnecessary_wraps)]
pub fn create_storage_with_file(_file: impl Into<PathBuf>) -> Option<Box<dyn epi::Storage>> { pub fn create_storage_with_file(_file: impl Into<PathBuf>) -> Option<Box<dyn epi::Storage>> {
#[cfg(feature = "persistence")] #[cfg(feature = "persistence")]
return Some(Box::new( return Some(Box::new(
@ -168,7 +168,7 @@ pub struct EpiIntegration {
} }
impl EpiIntegration { impl EpiIntegration {
#[expect(clippy::too_many_arguments)] #[allow(clippy::allow_attributes, clippy::too_many_arguments)]
pub fn new( pub fn new(
egui_ctx: egui::Context, egui_ctx: egui::Context,
window: &winit::window::Window, window: &winit::window::Window,
@ -325,13 +325,15 @@ impl EpiIntegration {
} }
} }
#[allow(clippy::unused_self, clippy::allow_attributes)] pub fn save(&mut self, app: &mut dyn epi::App, window: Option<&winit::window::Window>) {
pub fn save(&mut self, _app: &mut dyn epi::App, _window: Option<&winit::window::Window>) { #[cfg(not(feature = "persistence"))]
let _ = (self, app, window);
#[cfg(feature = "persistence")] #[cfg(feature = "persistence")]
if let Some(storage) = self.frame.storage_mut() { if let Some(storage) = self.frame.storage_mut() {
profiling::function_scope!(); profiling::function_scope!();
if let Some(window) = _window if let Some(window) = window
&& self.persist_window && self.persist_window
{ {
profiling::scope!("native_window"); profiling::scope!("native_window");
@ -341,14 +343,14 @@ impl EpiIntegration {
&WindowSettings::from_window(self.egui_ctx.zoom_factor(), window), &WindowSettings::from_window(self.egui_ctx.zoom_factor(), window),
); );
} }
if _app.persist_egui_memory() { if app.persist_egui_memory() {
profiling::scope!("egui_memory"); profiling::scope!("egui_memory");
self.egui_ctx self.egui_ctx
.memory(|mem| epi::set_value(storage, STORAGE_EGUI_MEMORY_KEY, mem)); .memory(|mem| epi::set_value(storage, STORAGE_EGUI_MEMORY_KEY, mem));
} }
{ {
profiling::scope!("App::save"); profiling::scope!("App::save");
_app.save(storage); app.save(storage);
} }
profiling::scope!("Storage::flush"); profiling::scope!("Storage::flush");

View File

@ -2497,6 +2497,7 @@ impl ContextImpl {
if self.memory.options.repaint_on_widget_change { if self.memory.options.repaint_on_widget_change {
profiling::scope!("compare-widget-rects"); profiling::scope!("compare-widget-rects");
#[allow(clippy::allow_attributes, clippy::collapsible_if)] // false positive on wasm
if viewport.prev_pass.widgets != viewport.this_pass.widgets { if viewport.prev_pass.widgets != viewport.this_pass.widgets {
repaint_needed = true; // Some widget has moved repaint_needed = true; // Some widget has moved
} }