1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 14:50:03 -04:00

Enable the clippy::std_instead_of_core lint (#8394)

Prefer `core::` over `std::` where either work

* Part of https://github.com/emilk/egui/issues/5735
This commit is contained in:
Emil Ernerfeldt
2026-08-06 04:19:13 -07:00
committed by GitHub
parent 2a5f3d99b5
commit 6aea7eff94
176 changed files with 633 additions and 615 deletions

View File

@@ -5,7 +5,7 @@
#![expect(clippy::undocumented_unsafe_blocks)]
#![expect(unsafe_code)]
use std::num::NonZeroU32;
use core::num::NonZeroU32;
use std::sync::Arc;
use egui_winit::winit;
@@ -146,7 +146,7 @@ impl GlutinWindowContext {
self.gl_surface.swap_buffers(&self.gl_context)
}
fn get_proc_address(&self, addr: &std::ffi::CStr) -> *const std::ffi::c_void {
fn get_proc_address(&self, addr: &core::ffi::CStr) -> *const core::ffi::c_void {
use glutin::display::GlDisplay as _;
self.gl_display.get_proc_address(addr)
}
@@ -154,7 +154,7 @@ impl GlutinWindowContext {
#[derive(Debug)]
pub enum UserEvent {
Redraw(std::time::Duration),
Redraw(core::time::Duration),
}
struct GlowApp {
@@ -162,7 +162,7 @@ struct GlowApp {
gl_window: Option<GlutinWindowContext>,
gl: Option<Arc<glow::Context>>,
egui_glow: Option<egui_glow::EguiGlow>,
repaint_delay: std::time::Duration,
repaint_delay: core::time::Duration,
clear_color: [f32; 3],
}
@@ -173,7 +173,7 @@ impl GlowApp {
gl_window: None,
gl: None,
egui_glow: None,
repaint_delay: std::time::Duration::MAX,
repaint_delay: core::time::Duration::MAX,
clear_color: [0.1, 0.1, 0.1],
}
}

View File

@@ -55,10 +55,10 @@ impl TextureWrapModeExt for egui::TextureWrapMode {
#[derive(Debug)]
pub struct PainterError(String);
impl std::error::Error for PainterError {}
impl core::error::Error for PainterError {}
impl std::fmt::Display for PainterError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl core::fmt::Display for PainterError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "OpenGL: {}", self.0)
}
}
@@ -219,7 +219,7 @@ impl Painter {
let a_tc_loc = gl.get_attrib_location(program, "a_tc").unwrap();
let a_srgba_loc = gl.get_attrib_location(program, "a_srgba").unwrap();
let stride = std::mem::size_of::<Vertex>() as i32;
let stride = core::mem::size_of::<Vertex>() as i32;
let buffer_infos = vec![
vao::BufferInfo {
location: a_pos_loc,

View File

@@ -2,7 +2,7 @@
#![expect(clippy::unwrap_used)] // TODO(emilk): avoid unwraps
#![expect(unsafe_code)]
use std::convert::TryInto as _;
use core::convert::TryInto as _;
/// Helper for parsing and interpreting the OpenGL shader version.
#[derive(Copy, Clone, Debug, PartialEq, Eq)]

View File

@@ -104,8 +104,8 @@ impl EguiGlow {
/// Paint the results of the last call to [`Self::run`].
pub fn paint(&mut self, window: &winit::window::Window) {
let shapes = std::mem::take(&mut self.shapes);
let mut textures_delta = std::mem::take(&mut self.textures_delta);
let shapes = core::mem::take(&mut self.shapes);
let mut textures_delta = core::mem::take(&mut self.textures_delta);
#[expect(clippy::iter_over_hash_type)] // Order doesn't matter here
for (id, image_deltas) in textures_delta.set.drain() {