Fix clippy issues from 1.74 (#3558)

Nothing major
This commit is contained in:
Emil Ernerfeldt 2023-11-16 15:50:44 +01:00 committed by GitHub
parent a243180600
commit f01b2b76c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 14 additions and 20 deletions

View File

@ -73,7 +73,7 @@ impl ContextImpl {
}
fn request_repaint_after(&mut self, delay: Duration, viewport_id: ViewportId) {
let mut viewport = self.viewports.entry(viewport_id).or_default();
let viewport = self.viewports.entry(viewport_id).or_default();
// Each request results in two repaints, just to give some things time to settle.
// This solves some corner-cases of missing repaints on frame-delayed responses.
@ -2607,7 +2607,7 @@ impl Context {
ctx.viewport_parents
.insert(new_viewport_id, ctx.viewport_id());
let mut viewport = ctx.viewports.entry(new_viewport_id).or_default();
let viewport = ctx.viewports.entry(new_viewport_id).or_default();
viewport.class = ViewportClass::Deferred;
viewport.builder = viewport_builder;
viewport.used = true;
@ -2666,7 +2666,7 @@ impl Context {
ctx.viewport_parents
.insert(new_viewport_id, parent_viewport_id);
let mut viewport = ctx.viewports.entry(new_viewport_id).or_default();
let viewport = ctx.viewports.entry(new_viewport_id).or_default();
viewport.builder = builder.clone();
viewport.used = true;
viewport.viewport_ui_cb = None; // it is immediate

View File

@ -119,7 +119,7 @@ impl std::fmt::Debug for Element {
match &self {
Self::Value { value, .. } => f
.debug_struct("Element::Value")
.field("type_id", &value.type_id())
.field("type_id", &(**value).type_id())
.finish_non_exhaustive(),
Self::Serialized(SerializedElement {
type_id,

View File

@ -802,12 +802,9 @@ impl<'t> TextEdit<'t> {
let glyph_count = row.glyphs.len();
let mut value = String::new();
value.reserve(glyph_count);
let mut character_lengths = Vec::<u8>::new();
character_lengths.reserve(glyph_count);
let mut character_positions = Vec::<f32>::new();
character_positions.reserve(glyph_count);
let mut character_widths = Vec::<f32>::new();
character_widths.reserve(glyph_count);
let mut character_lengths = Vec::<u8>::with_capacity(glyph_count);
let mut character_positions = Vec::<f32>::with_capacity(glyph_count);
let mut character_widths = Vec::<f32>::with_capacity(glyph_count);
let mut word_lengths = Vec::<u8>::new();
let mut was_at_word_end = false;
let mut last_word_start = 0usize;

View File

@ -45,7 +45,7 @@ pub struct EhttpLoader {
}
impl EhttpLoader {
pub const ID: &str = egui::generate_loader_id!(EhttpLoader);
pub const ID: &'static str = egui::generate_loader_id!(EhttpLoader);
}
const PROTOCOLS: &[&str] = &["http://", "https://"];

View File

@ -20,7 +20,7 @@ pub struct FileLoader {
}
impl FileLoader {
pub const ID: &str = egui::generate_loader_id!(FileLoader);
pub const ID: &'static str = egui::generate_loader_id!(FileLoader);
}
const PROTOCOL: &str = "file://";

View File

@ -14,7 +14,7 @@ pub struct ImageCrateLoader {
}
impl ImageCrateLoader {
pub const ID: &str = egui::generate_loader_id!(ImageCrateLoader);
pub const ID: &'static str = egui::generate_loader_id!(ImageCrateLoader);
}
fn is_supported_uri(uri: &str) -> bool {

View File

@ -14,7 +14,7 @@ pub struct SvgLoader {
}
impl SvgLoader {
pub const ID: &str = egui::generate_loader_id!(SvgLoader);
pub const ID: &'static str = egui::generate_loader_id!(SvgLoader);
}
fn is_supported(uri: &str) -> bool {

View File

@ -35,19 +35,16 @@ impl<T: Float> PartialEq<Self> for OrderedFloat<T> {
impl<T: Float> PartialOrd<Self> for OrderedFloat<T> {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
match self.0.partial_cmp(&other.0) {
Some(ord) => Some(ord),
None => Some(self.0.is_nan().cmp(&other.0.is_nan())),
}
Some(self.cmp(other))
}
}
impl<T: Float> Ord for OrderedFloat<T> {
#[inline]
fn cmp(&self, other: &Self) -> Ordering {
match self.partial_cmp(other) {
match self.0.partial_cmp(&other.0) {
Some(ord) => ord,
None => unreachable!(),
None => self.0.is_nan().cmp(&other.0.is_nan()),
}
}
}