1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

Enable more clippy lints (#6853)

* Follows https://github.com/emilk/egui/pull/6848
This commit is contained in:
Emil Ernerfeldt
2025-04-24 17:32:50 +02:00
committed by GitHub
parent fdb9aa282a
commit f9245954eb
124 changed files with 243 additions and 244 deletions

View File

@@ -2,7 +2,7 @@ mod button;
mod popup;
pub use button::DatePickerButton;
use chrono::{Datelike, Duration, NaiveDate, Weekday};
use chrono::{Datelike as _, Duration, NaiveDate, Weekday};
#[derive(Debug)]
struct Week {

View File

@@ -1,4 +1,4 @@
use chrono::{Datelike, NaiveDate, Weekday};
use chrono::{Datelike as _, NaiveDate, Weekday};
use egui::{Align, Button, Color32, ComboBox, Direction, Id, Layout, RichText, Ui, Vec2};

View File

@@ -1,4 +1,4 @@
use egui::{emath::GuiRounding, Id, Pos2, Rect, Response, Sense, Ui, UiBuilder};
use egui::{emath::GuiRounding as _, Id, Pos2, Rect, Response, Sense, Ui, UiBuilder};
#[derive(Clone, Copy)]
pub(crate) enum CellSize {

View File

@@ -26,7 +26,7 @@ mod table;
pub use crate::datepicker::DatePickerButton;
#[doc(hidden)]
#[allow(deprecated)]
#[expect(deprecated)]
pub use crate::image::RetainedImage;
pub(crate) use crate::layout::StripLayout;
pub use crate::sizing::Size;

View File

@@ -77,7 +77,7 @@ impl ImageLoader for ImageCrateLoader {
}
#[cfg(not(target_arch = "wasm32"))]
#[allow(clippy::unnecessary_wraps)] // needed here to match other return types
#[expect(clippy::unnecessary_wraps)] // needed here to match other return types
fn load_image(
ctx: &egui::Context,
uri: &str,

View File

@@ -30,7 +30,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)]
#[allow(unused_mut, clippy::allow_attributes)]
let mut options = resvg::usvg::Options::default();
#[cfg(feature = "svg_text")]

View File

@@ -5,7 +5,7 @@ use egui::{
mutex::Mutex,
ColorImage, FrameDurations, Id,
};
use image::{codecs::webp::WebPDecoder, AnimationDecoder as _, ColorType, ImageDecoder, Rgba};
use image::{codecs::webp::WebPDecoder, AnimationDecoder as _, ColorType, ImageDecoder as _, Rgba};
use std::{io::Cursor, mem::size_of, sync::Arc, time::Duration};
#[derive(Clone)]

View File

@@ -33,7 +33,7 @@ pub fn highlight(
// performing it at a separate thread (ctx, ctx.style()) can be used and when ui is available
// (ui.ctx(), ui.style()) can be used
#[allow(non_local_definitions)]
#[expect(non_local_definitions)]
impl egui::cache::ComputerMut<(&egui::FontId, &CodeTheme, &str, &str), LayoutJob> for Highlighter {
fn compute(
&mut self,
@@ -285,7 +285,7 @@ impl CodeTheme {
impl CodeTheme {
// The syntect version takes it by value. This could be avoided by specializing the from_style
// function, but at the cost of more code duplication.
#[allow(clippy::needless_pass_by_value)]
#[expect(clippy::needless_pass_by_value)]
fn dark_with_font_id(font_id: egui::FontId) -> Self {
use egui::{Color32, TextFormat};
Self {
@@ -302,7 +302,7 @@ impl CodeTheme {
}
// The syntect version takes it by value
#[allow(clippy::needless_pass_by_value)]
#[expect(clippy::needless_pass_by_value)]
fn light_with_font_id(font_id: egui::FontId) -> Self {
use egui::{Color32, TextFormat};
Self {
@@ -413,7 +413,6 @@ impl Default for Highlighter {
}
impl Highlighter {
#[allow(clippy::unused_self, clippy::unnecessary_wraps)]
fn highlight(
&self,
font_id: egui::FontId,
@@ -512,7 +511,7 @@ struct Highlighter {}
#[cfg(not(feature = "syntect"))]
impl Highlighter {
#[allow(clippy::unused_self, clippy::unnecessary_wraps)]
#[expect(clippy::unused_self, clippy::unnecessary_wraps)]
fn highlight_impl(
&self,
theme: &CodeTheme,