1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00

Fix some clippy warning from Rust 1.78.0 (#4444)

This commit is contained in:
Emil Ernerfeldt
2024-05-02 17:04:25 +02:00
committed by GitHub
parent c9b24d5a5c
commit ded8dbd45b
21 changed files with 37 additions and 72 deletions

View File

@@ -123,12 +123,12 @@ impl LineStyle {
}
}
impl ToString for LineStyle {
fn to_string(&self) -> String {
impl std::fmt::Display for LineStyle {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Solid => "Solid".into(),
Self::Dotted { spacing } => format!("Dotted{spacing}Px"),
Self::Dashed { length } => format!("Dashed{length}Px"),
Self::Solid => write!(f, "Solid"),
Self::Dotted { spacing } => write!(f, "Dotted({spacing} px)"),
Self::Dashed { length } => write!(f, "Dashed({length} px)"),
}
}
}
@@ -426,9 +426,9 @@ impl ExplicitGenerator {
/// Result of [`super::PlotItem::find_closest()`] search, identifies an element inside the item for immediate use
pub struct ClosestElem {
/// Position of hovered-over value (or bar/box-plot/...) in PlotItem
/// Position of hovered-over value (or bar/box-plot/...) in `PlotItem`
pub index: usize,
/// Squared distance from the mouse cursor (needed to compare against other PlotItems, which might be nearer)
/// Squared distance from the mouse cursor (needed to compare against other `PlotItems`, which might be nearer)
pub dist_sq: f32,
}