Enable and fix some more clippy lints
This commit is contained in:
parent
e1f348e4b2
commit
5093b67e9b
28 changed files with 44 additions and 44 deletions
|
@ -9,8 +9,10 @@ warn = [
|
|||
"clippy::bool_to_int_with_if",
|
||||
"clippy::char_lit_as_u8",
|
||||
"clippy::checked_conversions",
|
||||
"clippy::cloned_instead_of_copied",
|
||||
"clippy::dbg_macro",
|
||||
"clippy::debug_assert_with_mut_call",
|
||||
"clippy::derive_partial_eq_without_eq",
|
||||
"clippy::disallowed_methods",
|
||||
"clippy::disallowed_script_idents",
|
||||
"clippy::doc_link_with_quotes",
|
||||
|
@ -112,8 +114,6 @@ warn = [
|
|||
|
||||
allow = [
|
||||
# TODO(emilk): enable more lints
|
||||
"clippy::cloned_instead_of_copied",
|
||||
"clippy::derive_partial_eq_without_eq",
|
||||
"clippy::type_complexity",
|
||||
"clippy::undocumented_unsafe_blocks",
|
||||
"trivial_casts",
|
||||
|
|
|
@ -230,7 +230,7 @@ impl Area {
|
|||
|
||||
let layer_id = LayerId::new(order, id);
|
||||
|
||||
let state = ctx.memory().areas.get(id).cloned();
|
||||
let state = ctx.memory().areas.get(id).copied();
|
||||
let is_new = state.is_none();
|
||||
if is_new {
|
||||
ctx.request_repaint(); // if we don't know the previous size we are likely drawing the area in the wrong place
|
||||
|
|
|
@ -44,7 +44,7 @@ impl PanelState {
|
|||
// ----------------------------------------------------------------------------
|
||||
|
||||
/// [`Left`](Side::Left) or [`Right`](Side::Right)
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum Side {
|
||||
Left,
|
||||
Right,
|
||||
|
@ -468,7 +468,7 @@ impl SidePanel {
|
|||
// ----------------------------------------------------------------------------
|
||||
|
||||
/// [`Top`](TopBottomSide::Top) or [`Bottom`](TopBottomSide::Bottom)
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum TopBottomSide {
|
||||
Top,
|
||||
Bottom,
|
||||
|
|
|
@ -22,7 +22,7 @@ impl TooltipState {
|
|||
|
||||
fn individual_tooltip_size(&self, common_id: Id, index: usize) -> Option<Vec2> {
|
||||
if self.last_common_id == Some(common_id) {
|
||||
Some(self.individual_ids_and_sizes.get(&index).cloned()?.1)
|
||||
Some(self.individual_ids_and_sizes.get(&index)?.1)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -1513,7 +1513,7 @@ impl Context {
|
|||
ui.label("Hover to highlight");
|
||||
let layers_ids: Vec<LayerId> = self.memory().areas.order().to_vec();
|
||||
for layer_id in layers_ids {
|
||||
let area = self.memory().areas.get(layer_id.id).cloned();
|
||||
let area = self.memory().areas.get(layer_id.id).copied();
|
||||
if let Some(area) = area {
|
||||
let is_visible = self.memory().areas.is_visible(&layer_id);
|
||||
if !is_visible {
|
||||
|
|
|
@ -133,7 +133,7 @@ impl RawInput {
|
|||
}
|
||||
|
||||
/// A file about to be dropped into egui.
|
||||
#[derive(Clone, Debug, Default, PartialEq)]
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub struct HoveredFile {
|
||||
/// Set by the `egui-winit` backend.
|
||||
|
@ -144,7 +144,7 @@ pub struct HoveredFile {
|
|||
}
|
||||
|
||||
/// A file dropped into egui.
|
||||
#[derive(Clone, Debug, Default, PartialEq)]
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub struct DroppedFile {
|
||||
/// Set by the `egui-winit` backend.
|
||||
|
@ -305,7 +305,7 @@ pub const NUM_POINTER_BUTTONS: usize = 5;
|
|||
/// NOTE: For cross-platform uses, ALT+SHIFT is a bad combination of modifiers
|
||||
/// as on mac that is how you type special characters,
|
||||
/// so those key presses are usually not reported to egui.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub struct Modifiers {
|
||||
/// Either of the alt keys are down (option ⌥ on Mac).
|
||||
|
@ -768,7 +768,7 @@ impl Key {
|
|||
///
|
||||
/// Can be used with [`crate::InputState::consume_shortcut`]
|
||||
/// and [`crate::Context::format_shortcut`].
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub struct KeyboardShortcut {
|
||||
pub modifiers: Modifiers,
|
||||
pub key: Key,
|
||||
|
|
|
@ -156,7 +156,7 @@ impl PlatformOutput {
|
|||
}
|
||||
|
||||
/// What URL to open, and how.
|
||||
#[derive(Clone, PartialEq)]
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub struct OpenUrl {
|
||||
pub url: String,
|
||||
|
@ -190,7 +190,7 @@ impl OpenUrl {
|
|||
/// egui emits a [`CursorIcon`] in [`PlatformOutput`] each frame as a request to the integration.
|
||||
///
|
||||
/// Loosely based on <https://developer.mozilla.org/en-US/docs/Web/CSS/cursor>.
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub enum CursorIcon {
|
||||
/// Normal cursor icon, whatever that is.
|
||||
|
|
|
@ -109,7 +109,7 @@ impl LayerId {
|
|||
}
|
||||
|
||||
/// A unique identifier of a specific [`Shape`] in a [`PaintList`].
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
pub struct ShapeIdx(usize);
|
||||
|
||||
/// A list of [`Shape`]s paired with a clip rectangle.
|
||||
|
|
|
@ -75,7 +75,7 @@ impl Region {
|
|||
// ----------------------------------------------------------------------------
|
||||
|
||||
/// Layout direction, one of [`LeftToRight`](Direction::LeftToRight), [`RightToLeft`](Direction::RightToLeft), [`TopDown`](Direction::TopDown), [`BottomUp`](Direction::BottomUp).
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub enum Direction {
|
||||
LeftToRight,
|
||||
|
@ -114,7 +114,7 @@ impl Direction {
|
|||
/// });
|
||||
/// # });
|
||||
/// ```
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
// #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub struct Layout {
|
||||
/// Main axis direction
|
||||
|
|
|
@ -507,7 +507,7 @@ pub mod special_emojis {
|
|||
}
|
||||
|
||||
/// The different types of built-in widgets in egui
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub enum WidgetType {
|
||||
Label, // TODO(emilk): emit Label events
|
||||
|
|
|
@ -587,8 +587,8 @@ impl Areas {
|
|||
pub fn visible_layer_ids(&self) -> ahash::HashSet<LayerId> {
|
||||
self.visible_last_frame
|
||||
.iter()
|
||||
.cloned()
|
||||
.chain(self.visible_current_frame.iter().cloned())
|
||||
.copied()
|
||||
.chain(self.visible_current_frame.iter().copied())
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
|
|
@ -592,7 +592,7 @@ impl WidgetVisuals {
|
|||
}
|
||||
|
||||
/// Options for help debug egui by adding extra visualization
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub struct DebugOptions {
|
||||
/// However over widgets to see their rectangles
|
||||
|
|
|
@ -211,7 +211,7 @@ fn color_slider_2d(
|
|||
}
|
||||
|
||||
/// What options to show for alpha
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Alpha {
|
||||
// Set alpha to 1.0, and show no option for it.
|
||||
Opaque,
|
||||
|
@ -425,7 +425,7 @@ pub fn color_edit_button_rgb(ui: &mut Ui, rgb: &mut [f32; 3]) -> Response {
|
|||
// To ensure we keep hue slider when `srgba` is gray we store the full [`Hsva`] in a cache:
|
||||
fn color_cache_get(ctx: &Context, rgba: impl Into<Rgba>) -> Hsva {
|
||||
let rgba = rgba.into();
|
||||
use_color_cache(ctx, |cc| cc.get(&rgba).cloned()).unwrap_or_else(|| Hsva::from(rgba))
|
||||
use_color_cache(ctx, |cc| cc.get(&rgba).copied()).unwrap_or_else(|| Hsva::from(rgba))
|
||||
}
|
||||
|
||||
// To ensure we keep hue slider when `srgba` is gray we store the full [`Hsva`] in a cache:
|
||||
|
|
|
@ -5,7 +5,7 @@ use crate::*;
|
|||
use super::items::PlotItem;
|
||||
|
||||
/// Where to place the plot legend.
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Corner {
|
||||
LeftTop,
|
||||
RightTop,
|
||||
|
|
|
@ -76,7 +76,7 @@ pub fn drop_target<R>(
|
|||
InnerResponse::new(ret, response)
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq)]
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub struct DragAndDropDemo {
|
||||
/// columns with items
|
||||
|
|
|
@ -21,7 +21,7 @@ impl Default for LayoutTest {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
pub struct LayoutSettings {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/// Showcase [`TextEdit`].
|
||||
#[derive(PartialEq)]
|
||||
#[derive(PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
pub struct TextEdit {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#[derive(Clone, PartialEq, Default)]
|
||||
#[derive(Clone, Default, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub struct WindowWithPanels {}
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ impl Rect {
|
|||
/// Rotate the bounds (will expand the [`Rect`])
|
||||
#[must_use]
|
||||
#[inline]
|
||||
pub fn rotate_bb(self, rot: crate::Rot2) -> Self {
|
||||
pub fn rotate_bb(self, rot: Rot2) -> Self {
|
||||
let a = rot * self.left_top().to_vec2();
|
||||
let b = rot * self.right_top().to_vec2();
|
||||
let c = rot * self.left_bottom().to_vec2();
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use crate::*;
|
||||
use crate::{pos2, remap, remap_clamp, Pos2, Rect, Vec2};
|
||||
|
||||
/// Linearly transforms positions from one [`Rect`] to another.
|
||||
///
|
||||
/// [`RectTransform`] stores the rectangles, and therefore supports clamping and culling.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
|
||||
pub struct RectTransform {
|
||||
|
|
|
@ -43,7 +43,7 @@ impl ImageData {
|
|||
// ----------------------------------------------------------------------------
|
||||
|
||||
/// A 2D RGBA color image in RAM.
|
||||
#[derive(Clone, Default, PartialEq)]
|
||||
#[derive(Clone, Default, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub struct ColorImage {
|
||||
/// width, height.
|
||||
|
|
|
@ -5,7 +5,7 @@ use emath::*;
|
|||
///
|
||||
/// Should be friendly to send to GPU as is.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
|
||||
pub struct Vertex {
|
||||
|
@ -23,7 +23,7 @@ pub struct Vertex {
|
|||
}
|
||||
|
||||
/// Textured triangles in two dimensions.
|
||||
#[derive(Clone, Debug, Default, PartialEq)]
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub struct Mesh {
|
||||
/// Draw as triangles (i.e. the length is always multiple of three).
|
||||
|
|
|
@ -30,7 +30,7 @@ impl Shadow {
|
|||
}
|
||||
}
|
||||
|
||||
/// Used for widnows in dark mode.
|
||||
/// Used for egui windows in dark mode.
|
||||
pub fn big_dark() -> Self {
|
||||
Self {
|
||||
extrusion: 32.0,
|
||||
|
@ -38,7 +38,7 @@ impl Shadow {
|
|||
}
|
||||
}
|
||||
|
||||
/// Used for widnows in light mode.
|
||||
/// Used for egui windows in light mode.
|
||||
pub fn big_light() -> Self {
|
||||
Self {
|
||||
extrusion: 32.0,
|
||||
|
@ -46,7 +46,7 @@ impl Shadow {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn tessellate(&self, rect: emath::Rect, rounding: impl Into<Rounding>) -> Mesh {
|
||||
pub fn tessellate(&self, rect: Rect, rounding: impl Into<Rounding>) -> Mesh {
|
||||
// tessellator.clip_rect = clip_rect; // TODO(emilk): culling
|
||||
|
||||
let Self { extrusion, color } = *self;
|
||||
|
|
|
@ -586,7 +586,7 @@ pub mod path {
|
|||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
pub enum PathType {
|
||||
Open,
|
||||
Closed,
|
||||
|
|
|
@ -66,7 +66,7 @@ impl std::ops::SubAssign<usize> for CCursor {
|
|||
}
|
||||
|
||||
/// Row Cursor
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub struct RCursor {
|
||||
/// 0 is first row, and so on.
|
||||
|
|
|
@ -8,7 +8,7 @@ use std::sync::Arc;
|
|||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub struct UvRect {
|
||||
/// X/Y offset for nice rendering (unit: points).
|
||||
|
|
|
@ -351,7 +351,7 @@ pub struct Galley {
|
|||
pub pixels_per_point: f32,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub struct Row {
|
||||
/// One for each `char`.
|
||||
|
@ -374,7 +374,7 @@ pub struct Row {
|
|||
}
|
||||
|
||||
/// The tessellated output of a row.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub struct RowVisuals {
|
||||
/// The tessellated text, using non-normalized (texel) UV coordinates.
|
||||
|
@ -400,7 +400,7 @@ impl Default for RowVisuals {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub struct Glyph {
|
||||
/// The character this glyph represents.
|
||||
|
|
|
@ -117,7 +117,7 @@ impl TextureManager {
|
|||
}
|
||||
|
||||
/// Meta-data about an allocated texture.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct TextureMeta {
|
||||
/// A human-readable name useful for debugging.
|
||||
pub name: String,
|
||||
|
|
Loading…
Reference in a new issue