mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 13:20:05 -04:00
Enable more clippy lints (#6853)
* Follows https://github.com/emilk/egui/pull/6848
This commit is contained in:
@@ -72,7 +72,7 @@ pub use self::{
|
||||
#[deprecated = "Renamed to CornerRadius"]
|
||||
pub type Rounding = CornerRadius;
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[expect(deprecated)]
|
||||
pub use tessellator::tessellate_shapes;
|
||||
|
||||
pub use ecolor::{Color32, Hsva, HsvaGamma, Rgba};
|
||||
|
||||
@@ -296,7 +296,7 @@ impl Shape {
|
||||
Self::Rect(RectShape::stroke(rect, corner_radius, stroke, stroke_kind))
|
||||
}
|
||||
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
pub fn text(
|
||||
fonts: &Fonts,
|
||||
pos: Pos2,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#![allow(clippy::identity_op)]
|
||||
|
||||
use emath::{pos2, remap, vec2, GuiRounding as _, NumExt, Pos2, Rect, Rot2, Vec2};
|
||||
use emath::{pos2, remap, vec2, GuiRounding as _, NumExt as _, Pos2, Rect, Rot2, Vec2};
|
||||
|
||||
use crate::{
|
||||
color::ColorMode, emath, stroke::PathStroke, texture_atlas::PreparedDisc, CircleShape,
|
||||
@@ -16,7 +16,7 @@ use crate::{
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#[allow(clippy::approx_constant)]
|
||||
#[expect(clippy::approx_constant)]
|
||||
mod precomputed_vertices {
|
||||
// fn main() {
|
||||
// let n = 64;
|
||||
@@ -2222,7 +2222,7 @@ impl Tessellator {
|
||||
///
|
||||
/// ## Returns
|
||||
/// A list of clip rectangles with matching [`Mesh`].
|
||||
#[allow(unused_mut)]
|
||||
#[allow(unused_mut, clippy::allow_attributes)]
|
||||
pub fn tessellate_shapes(&mut self, mut shapes: Vec<ClippedShape>) -> Vec<ClippedPrimitive> {
|
||||
profiling::function_scope!();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::collections::BTreeMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use emath::{vec2, GuiRounding, Vec2};
|
||||
use emath::{vec2, GuiRounding as _, Vec2};
|
||||
|
||||
use crate::{
|
||||
mutex::{Mutex, RwLock},
|
||||
@@ -100,7 +100,7 @@ impl FontImpl {
|
||||
"pixels_per_point must be greater than 0, got: {pixels_per_point:?}"
|
||||
);
|
||||
|
||||
use ab_glyph::{Font, ScaleFont};
|
||||
use ab_glyph::{Font as _, ScaleFont as _};
|
||||
let scaled = ab_glyph_font.as_scaled(scale_in_pixels);
|
||||
let ascent = (scaled.ascent() / pixels_per_point).round_ui();
|
||||
let descent = (scaled.descent() / pixels_per_point).round_ui();
|
||||
@@ -241,7 +241,7 @@ impl FontImpl {
|
||||
last_glyph_id: ab_glyph::GlyphId,
|
||||
glyph_id: ab_glyph::GlyphId,
|
||||
) -> f32 {
|
||||
use ab_glyph::{Font as _, ScaleFont};
|
||||
use ab_glyph::{Font as _, ScaleFont as _};
|
||||
self.ab_glyph_font
|
||||
.as_scaled(self.scale_in_pixels as f32)
|
||||
.kern(last_glyph_id, glyph_id)
|
||||
@@ -271,7 +271,7 @@ impl FontImpl {
|
||||
|
||||
fn allocate_glyph(&self, glyph_id: ab_glyph::GlyphId) -> GlyphInfo {
|
||||
assert!(glyph_id.0 != 0, "Can't allocate glyph for id 0");
|
||||
use ab_glyph::{Font as _, ScaleFont};
|
||||
use ab_glyph::{Font as _, ScaleFont as _};
|
||||
|
||||
let glyph = glyph_id.with_scale_and_position(
|
||||
self.scale_in_pixels as f32,
|
||||
|
||||
@@ -54,7 +54,6 @@ impl FontId {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::derived_hash_with_manual_eq)]
|
||||
impl std::hash::Hash for FontId {
|
||||
#[inline(always)]
|
||||
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use emath::{pos2, vec2, Align, GuiRounding as _, NumExt, Pos2, Rect, Vec2};
|
||||
use emath::{pos2, vec2, Align, GuiRounding as _, NumExt as _, Pos2, Rect, Vec2};
|
||||
|
||||
use crate::{stroke::PathStroke, text::font::Font, Color32, Mesh, Stroke, Vertex};
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ use super::{
|
||||
font::UvRect,
|
||||
};
|
||||
use crate::{Color32, FontId, Mesh, Stroke};
|
||||
use emath::{pos2, vec2, Align, GuiRounding as _, NumExt, OrderedFloat, Pos2, Rect, Vec2};
|
||||
use emath::{pos2, vec2, Align, GuiRounding as _, NumExt as _, OrderedFloat, Pos2, Rect, Vec2};
|
||||
|
||||
/// Describes the task of laying out text.
|
||||
///
|
||||
@@ -971,7 +971,7 @@ impl Galley {
|
||||
///
|
||||
/// This is the same as [`CCursor::default`].
|
||||
#[inline]
|
||||
#[allow(clippy::unused_self)]
|
||||
#[expect(clippy::unused_self)]
|
||||
pub fn begin(&self) -> CCursor {
|
||||
CCursor::default()
|
||||
}
|
||||
@@ -1062,7 +1062,7 @@ impl Galley {
|
||||
|
||||
/// ## Cursor positions
|
||||
impl Galley {
|
||||
#[allow(clippy::unused_self)]
|
||||
#[expect(clippy::unused_self)]
|
||||
pub fn cursor_left_one_character(&self, cursor: &CCursor) -> CCursor {
|
||||
if cursor.index == 0 {
|
||||
Default::default()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::{
|
||||
emath::NumExt, mutex::RwLock, textures::TextureOptions, ImageData, ImageDelta, TextureId,
|
||||
emath::NumExt as _, mutex::RwLock, textures::TextureOptions, ImageData, ImageDelta, TextureId,
|
||||
TextureManager,
|
||||
};
|
||||
|
||||
@@ -66,7 +66,7 @@ impl TextureHandle {
|
||||
}
|
||||
|
||||
/// Assign a new image to an existing texture.
|
||||
#[allow(clippy::needless_pass_by_ref_mut)] // Intentionally hide interiority of mutability
|
||||
#[expect(clippy::needless_pass_by_ref_mut)] // Intentionally hide interiority of mutability
|
||||
pub fn set(&mut self, image: impl Into<ImageData>, options: TextureOptions) {
|
||||
self.tex_mngr
|
||||
.write()
|
||||
@@ -74,7 +74,7 @@ impl TextureHandle {
|
||||
}
|
||||
|
||||
/// Assign a new image to a subregion of the whole texture.
|
||||
#[allow(clippy::needless_pass_by_ref_mut)] // Intentionally hide interiority of mutability
|
||||
#[expect(clippy::needless_pass_by_ref_mut)] // Intentionally hide interiority of mutability
|
||||
pub fn set_partial(
|
||||
&mut self,
|
||||
pos: [usize; 2],
|
||||
|
||||
Reference in New Issue
Block a user