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

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

View File

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

View File

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

View File

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