1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 04:40: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

@@ -316,7 +316,7 @@ fn warn_if_rect_changes_id() {
#[test]
#[cfg(debug_assertions)]
fn warn_if_rect_changes_id_false_positive_parent_shift() {
use std::cell::Cell;
use core::cell::Cell;
let counter = Cell::new(0);
let button_rect = egui::Rect::from_min_size(egui::pos2(10.0, 10.0), egui::vec2(100.0, 30.0));

View File

@@ -220,8 +220,8 @@ fn test_atom_selectable_senses_click_and_drag() {
/// See <https://github.com/emilk/egui/issues/8217>.
#[test]
fn test_atom_selectable_text_can_be_copied() {
use core::cell::Cell;
use egui::{AtomLayout, Event, Modifiers, OutputCommand, PointerButton, Pos2, Rect};
use std::cell::Cell;
fn copied_text(selectable: bool) -> Option<String> {
let rect_cell = Cell::new(Rect::NOTHING);

View File

@@ -381,7 +381,7 @@ fn switched_bottom_panel_harness(start_expanded: bool) -> Harness<'static, Switc
}
/// Assert that the panel edge crossed `gap` gradually, rather than in one frame.
fn assert_crossed_gradually(tops: &[f32], gap: std::ops::Range<f32>) {
fn assert_crossed_gradually(tops: &[f32], gap: core::ops::Range<f32>) {
let frames_in_gap = tops.iter().filter(|top| gap.contains(top)).count();
assert!(
3 <= frames_in_gap,

View File

@@ -2,7 +2,7 @@
#![expect(rustdoc::missing_crate_level_docs)]
#![allow(clippy::print_stderr)]
use std::time::Duration;
use core::time::Duration;
use eframe::egui::{self, ViewportInfo};
@@ -56,7 +56,7 @@ fn viewport_info(ctx: &egui::Context) -> String {
];
for (name, value) in flags {
if let Some(value) = value {
use std::fmt::Write as _;
use core::fmt::Write as _;
write!(s, " {name}={value}").ok();
}
}

View File

@@ -11,7 +11,7 @@
use eframe::egui;
use eframe::glow;
fn main() -> Result<(), Box<dyn std::error::Error>> {
fn main() -> Result<(), Box<dyn core::error::Error>> {
env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`).
let options = eframe::NativeOptions {
renderer: eframe::Renderer::Glow,