1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 06:10:06 -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

@@ -1,7 +1,7 @@
use super::popup::DatePickerPopup;
use core::ops::RangeInclusive;
use egui::{Area, Button, Frame, InnerResponse, Key, Order, RichText, Ui, Widget};
use jiff::civil::Date;
use std::ops::RangeInclusive;
#[derive(Default, Clone)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]

View File

@@ -26,7 +26,7 @@ fn month_data(year: i16, month: i8) -> Vec<Week> {
if start.weekday() == Weekday::Sunday {
weeks.push(Week {
number: ISOWeekDate::from(start).week() as u8,
days: std::mem::take(&mut week),
days: core::mem::take(&mut week),
});
}
start = start.tomorrow().unwrap();

View File

@@ -32,7 +32,7 @@ pub(crate) struct DatePickerPopup<'a> {
pub calendar: bool,
pub calendar_week: bool,
pub highlight_weekends: bool,
pub start_end_years: Option<std::ops::RangeInclusive<i16>>,
pub start_end_years: Option<core::ops::RangeInclusive<i16>>,
pub reverse_years: bool,
pub year_scroll_to: Option<i16>,
}

View File

@@ -1,9 +1,10 @@
use ahash::HashMap;
use core::task::Poll;
use egui::{
load::{Bytes, BytesLoadResult, BytesLoader, BytesPoll, LoadError},
mutex::Mutex,
};
use std::{path::PathBuf, sync::Arc, task::Poll, thread};
use std::{path::PathBuf, sync::Arc, thread};
#[derive(Clone)]
struct File {

View File

@@ -1,11 +1,12 @@
use ahash::HashMap;
use core::{mem::size_of, time::Duration};
use egui::{
ColorImage, FrameDurations, Id, decode_animated_image_uri, has_gif_magic_header,
load::{BytesPoll, ImageLoadResult, ImageLoader, ImagePoll, LoadError, SizeHint},
mutex::Mutex,
};
use image::AnimationDecoder as _;
use std::{io::Cursor, mem::size_of, sync::Arc, time::Duration};
use std::{io::Cursor, sync::Arc};
/// Array of Frames and the duration for how long each frame should be shown
#[derive(Debug, Clone)]

View File

@@ -1,9 +1,10 @@
use ahash::HashMap;
use core::task::Poll;
use egui::{
load::{Bytes, BytesLoadResult, BytesLoader, BytesPoll, LoadError},
mutex::Mutex,
};
use std::{sync::Arc, task::Poll};
use std::sync::Arc;
#[derive(Clone)]
struct File {

View File

@@ -1,11 +1,12 @@
use ahash::HashMap;
use core::{mem::size_of, task::Poll};
use egui::{
ColorImage, decode_animated_image_uri,
load::{Bytes, BytesPoll, ImageLoadResult, ImageLoader, ImagePoll, LoadError, SizeHint},
mutex::Mutex,
};
use image::ImageFormat;
use std::{mem::size_of, path::Path, sync::Arc, task::Poll};
use std::{path::Path, sync::Arc};
#[cfg(not(target_arch = "wasm32"))]
use std::thread;
@@ -146,7 +147,7 @@ impl ImageLoader for ImageCrateLoader {
.map(Arc::new)
.map_err(|err| err.to_string());
log::trace!("finished loading {uri:?}");
cache_lock.insert(uri.into(), std::task::Poll::Ready(result.clone()));
cache_lock.insert(uri.into(), core::task::Poll::Ready(result.clone()));
match result {
Ok(image) => Ok(ImagePoll::Ready { image }),
Err(err) => Err(LoadError::Loading(err)),

View File

@@ -1,4 +1,5 @@
use std::{mem::size_of, sync::Arc};
use core::mem::size_of;
use std::sync::Arc;
use ahash::HashMap;

View File

@@ -1,11 +1,12 @@
use ahash::HashMap;
use core::{mem::size_of, time::Duration};
use egui::{
ColorImage, FrameDurations, Id, decode_animated_image_uri, has_webp_header,
load::{BytesPoll, ImageLoadResult, ImageLoader, ImagePoll, LoadError, SizeHint},
mutex::Mutex,
};
use image::{AnimationDecoder as _, ColorType, ImageDecoder as _, Rgba, codecs::webp::WebPDecoder};
use std::{io::Cursor, mem::size_of, sync::Arc, time::Duration};
use std::{io::Cursor, sync::Arc};
#[derive(Clone)]
enum WebP {

View File

@@ -514,9 +514,9 @@ struct HighlightSettings<'a>(&'a SyntectSettings);
#[derive(Copy, Clone)]
struct HighlightSettings<'a>(&'a ());
impl std::hash::Hash for HighlightSettings<'_> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
std::ptr::hash(self.0, state);
impl core::hash::Hash for HighlightSettings<'_> {
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
core::ptr::hash(self.0, state);
}
}