Fix some clippy warning from Rust 1.78.0 (#4444)
This commit is contained in:
parent
c9b24d5a5c
commit
ded8dbd45b
|
|
@ -232,7 +232,7 @@ pub enum HardwareAcceleration {
|
|||
|
||||
/// Do NOT use graphics acceleration.
|
||||
///
|
||||
/// On some platforms (MacOS) this is ignored and treated the same as [`Self::Preferred`].
|
||||
/// On some platforms (macOS) this is ignored and treated the same as [`Self::Preferred`].
|
||||
Off,
|
||||
}
|
||||
|
||||
|
|
@ -518,10 +518,10 @@ pub enum WebGlContextOption {
|
|||
/// Force use WebGL2.
|
||||
WebGl2,
|
||||
|
||||
/// Use WebGl2 first.
|
||||
/// Use WebGL2 first.
|
||||
BestFirst,
|
||||
|
||||
/// Use WebGl1 first
|
||||
/// Use WebGL1 first
|
||||
CompatibilityFirst,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -360,21 +360,6 @@ impl WinitApp for GlowWinitApp {
|
|||
.map_or(0, |r| r.integration.egui_ctx.frame_nr_for(viewport_id))
|
||||
}
|
||||
|
||||
fn is_focused(&self, window_id: WindowId) -> bool {
|
||||
if let Some(running) = &self.running {
|
||||
let glutin = running.glutin.borrow();
|
||||
if let Some(window_id) = glutin.viewport_from_window.get(&window_id) {
|
||||
return glutin.focused_viewport == Some(*window_id);
|
||||
}
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
fn integration(&self) -> Option<&EpiIntegration> {
|
||||
self.running.as_ref().map(|r| &r.integration)
|
||||
}
|
||||
|
||||
fn window(&self, window_id: WindowId) -> Option<Arc<Window>> {
|
||||
let running = self.running.as_ref()?;
|
||||
let glutin = running.glutin.borrow();
|
||||
|
|
|
|||
|
|
@ -341,20 +341,6 @@ impl WinitApp for WgpuWinitApp {
|
|||
.map_or(0, |r| r.integration.egui_ctx.frame_nr_for(viewport_id))
|
||||
}
|
||||
|
||||
fn is_focused(&self, window_id: WindowId) -> bool {
|
||||
if let Some(running) = &self.running {
|
||||
let shared = running.shared.borrow();
|
||||
let viewport_id = shared.viewport_from_window.get(&window_id).copied();
|
||||
shared.focused_viewport.is_some() && shared.focused_viewport == viewport_id
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
fn integration(&self) -> Option<&EpiIntegration> {
|
||||
self.running.as_ref().map(|r| &r.integration)
|
||||
}
|
||||
|
||||
fn window(&self, window_id: WindowId) -> Option<Arc<Window>> {
|
||||
self.running
|
||||
.as_ref()
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ use egui::ViewportId;
|
|||
#[cfg(feature = "accesskit")]
|
||||
use egui_winit::accesskit_winit;
|
||||
|
||||
use super::epi_integration::EpiIntegration;
|
||||
|
||||
/// Create an egui context, restoring it from storage if possible.
|
||||
pub fn create_egui_context(storage: Option<&dyn crate::Storage>) -> egui::Context {
|
||||
crate::profile_function!();
|
||||
|
|
@ -64,10 +62,6 @@ pub trait WinitApp {
|
|||
/// The current frame number, as reported by egui.
|
||||
fn frame_nr(&self, viewport_id: ViewportId) -> u64;
|
||||
|
||||
fn is_focused(&self, window_id: WindowId) -> bool;
|
||||
|
||||
fn integration(&self) -> Option<&EpiIntegration>;
|
||||
|
||||
fn window(&self, window_id: WindowId) -> Option<Arc<Window>>;
|
||||
|
||||
fn window_id_from_viewport_id(&self, id: ViewportId) -> Option<WindowId>;
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ pub struct Renderer {
|
|||
texture_bind_group_layout: wgpu::BindGroupLayout,
|
||||
|
||||
/// Map of egui texture IDs to textures and their associated bindgroups (texture view +
|
||||
/// sampler). The texture may be None if the TextureId is just a handle to a user-provided
|
||||
/// sampler). The texture may be None if the `TextureId` is just a handle to a user-provided
|
||||
/// sampler.
|
||||
textures: HashMap<epaint::TextureId, (Option<wgpu::Texture>, wgpu::BindGroup)>,
|
||||
next_user_texture_id: u64,
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ impl Painter {
|
|||
|
||||
if let Some(window) = window {
|
||||
let size = window.inner_size();
|
||||
if self.surfaces.get(&viewport_id).is_none() {
|
||||
if !self.surfaces.contains_key(&viewport_id) {
|
||||
let surface = self.instance.create_surface(window)?;
|
||||
self.add_surface(surface, viewport_id, size).await?;
|
||||
}
|
||||
|
|
@ -235,7 +235,7 @@ impl Painter {
|
|||
|
||||
if let Some(window) = window {
|
||||
let size = window.inner_size();
|
||||
if self.surfaces.get(&viewport_id).is_none() {
|
||||
if !self.surfaces.contains_key(&viewport_id) {
|
||||
let surface = unsafe {
|
||||
self.instance
|
||||
.create_surface_unsafe(wgpu::SurfaceTargetUnsafe::from_window(&window)?)?
|
||||
|
|
|
|||
|
|
@ -21,12 +21,12 @@ pub(crate) struct FrameState {
|
|||
/// All [`Id`]s that were used this frame.
|
||||
pub(crate) used_ids: IdMap<Rect>,
|
||||
|
||||
/// Starts off as the screen_rect, shrinks as panels are added.
|
||||
/// Starts off as the `screen_rect`, shrinks as panels are added.
|
||||
/// The [`CentralPanel`] does not change this.
|
||||
/// This is the area available to Window's.
|
||||
pub(crate) available_rect: Rect,
|
||||
|
||||
/// Starts off as the screen_rect, shrinks as panels are added.
|
||||
/// Starts off as the `screen_rect`, shrinks as panels are added.
|
||||
/// The [`CentralPanel`] retracts from this.
|
||||
pub(crate) unused_rect: Rect,
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ pub struct InputState {
|
|||
/// State of the mouse or simple touch gestures which can be mapped to mouse operations.
|
||||
pub pointer: PointerState,
|
||||
|
||||
/// State of touches, except those covered by PointerState (like clicks and drags).
|
||||
/// State of touches, except those covered by `PointerState` (like clicks and drags).
|
||||
/// (We keep a separate [`TouchState`] for each encountered touch device.)
|
||||
touch_states: BTreeMap<TouchDeviceId, TouchState>,
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ pub(crate) struct TouchState {
|
|||
|
||||
/// Active touches, if any.
|
||||
///
|
||||
/// TouchId is the unique identifier of the touch. It is valid as long as the finger/pen touches the surface. The
|
||||
/// `TouchId` is the unique identifier of the touch. It is valid as long as the finger/pen touches the surface. The
|
||||
/// next touch will receive a new unique ID.
|
||||
///
|
||||
/// Refer to [`ActiveTouch`].
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ pub(crate) struct Region {
|
|||
/// Always finite.
|
||||
///
|
||||
/// The bounding box of all child widgets, but not necessarily a tight bounding box
|
||||
/// since [`Ui`](crate::Ui) can start with a non-zero min_rect size.
|
||||
/// since [`Ui`](crate::Ui) can start with a non-zero `min_rect` size.
|
||||
pub min_rect: Rect,
|
||||
|
||||
/// The maximum size of this [`Ui`](crate::Ui). This is a *soft max*
|
||||
|
|
@ -38,7 +38,7 @@ pub(crate) struct Region {
|
|||
/// So one can think of `cursor` as a constraint on the available region.
|
||||
///
|
||||
/// If something has already been added, this will point to `style.spacing.item_spacing` beyond the latest child.
|
||||
/// The cursor can thus be `style.spacing.item_spacing` pixels outside of the min_rect.
|
||||
/// The cursor can thus be `style.spacing.item_spacing` pixels outside of the `min_rect`.
|
||||
pub(crate) cursor: Rect,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,19 +5,19 @@ pub enum OperatingSystem {
|
|||
/// Unknown OS - could be wasm
|
||||
Unknown,
|
||||
|
||||
/// Android OS.
|
||||
/// Android OS
|
||||
Android,
|
||||
|
||||
/// Apple iPhone OS.
|
||||
/// Apple iPhone OS
|
||||
IOS,
|
||||
|
||||
/// Linux or Unix other than Android.
|
||||
/// Linux or Unix other than Android
|
||||
Nix,
|
||||
|
||||
/// MacOS.
|
||||
/// macOS
|
||||
Mac,
|
||||
|
||||
/// Windows.
|
||||
/// Windows
|
||||
Windows,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ pub struct Style {
|
|||
///
|
||||
/// The most convenient way to look something up in this is to use [`TextStyle::resolve`].
|
||||
///
|
||||
/// If you would like to overwrite app text_styles
|
||||
/// If you would like to overwrite app `text_styles`
|
||||
///
|
||||
/// ```
|
||||
/// # let mut ctx = egui::Context::default();
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ pub struct Undoer<State> {
|
|||
|
||||
/// Stores redos immediately after a sequence of undos.
|
||||
/// Gets cleared every time the state changes.
|
||||
/// Does not need to be a deque, because there can only be up to undos.len() redos,
|
||||
/// which is already limited to settings.max_undos.
|
||||
/// Does not need to be a deque, because there can only be up to `undos.len()` redos,
|
||||
/// which is already limited to `settings.max_undos`.
|
||||
redos: Vec<State>,
|
||||
|
||||
#[cfg_attr(feature = "serde", serde(skip))]
|
||||
|
|
|
|||
|
|
@ -1071,7 +1071,7 @@ pub enum ViewportCommand {
|
|||
/// This is equivalent to the system keyboard shortcut for copy (e.g. CTRL + C).
|
||||
RequestCopy,
|
||||
|
||||
/// Request a paste from the clipboard to the current focused TextEdit if any.
|
||||
/// Request a paste from the clipboard to the current focused `TextEdit` if any.
|
||||
///
|
||||
/// This is equivalent to the system keyboard shortcut for paste (e.g. CTRL + V).
|
||||
RequestPaste,
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ impl TextBuffer for String {
|
|||
}
|
||||
|
||||
fn replace_with(&mut self, text: &str) {
|
||||
*self = text.to_owned();
|
||||
text.clone_into(self);
|
||||
}
|
||||
|
||||
fn take(&mut self) -> String {
|
||||
|
|
|
|||
|
|
@ -464,7 +464,7 @@ impl WrapApp {
|
|||
// Collect dropped files:
|
||||
ctx.input(|i| {
|
||||
if !i.raw.dropped_files.is_empty() {
|
||||
self.dropped_files = i.raw.dropped_files.clone();
|
||||
self.dropped_files.clone_from(&i.raw.dropped_files);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ impl MemoizedEasymarkHighlighter {
|
|||
pub fn highlight(&mut self, egui_style: &egui::Style, code: &str) -> egui::text::LayoutJob {
|
||||
if (&self.style, self.code.as_str()) != (egui_style, code) {
|
||||
self.style = egui_style.clone();
|
||||
self.code = code.to_owned();
|
||||
code.clone_into(&mut self.code);
|
||||
self.output = highlight_easymark(egui_style, code);
|
||||
}
|
||||
self.output.clone()
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ use super::Vec2;
|
|||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
|
||||
pub struct Rot2 {
|
||||
/// angle.sin()
|
||||
/// `angle.sin()`
|
||||
s: f32,
|
||||
|
||||
/// angle.cos()
|
||||
/// `angle.cos()`
|
||||
c: f32,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -453,9 +453,9 @@ pub struct Galley {
|
|||
/// `rect.top()` is always 0.0.
|
||||
///
|
||||
/// With [`LayoutJob::halign`]:
|
||||
/// * [`Align::LEFT`]: rect.left() == 0.0
|
||||
/// * [`Align::Center`]: rect.center() == 0.0
|
||||
/// * [`Align::RIGHT`]: rect.right() == 0.0
|
||||
/// * [`Align::LEFT`]: `rect.left() == 0.0`
|
||||
/// * [`Align::Center`]: `rect.center() == 0.0`
|
||||
/// * [`Align::RIGHT`]: `rect.right() == 0.0`
|
||||
pub rect: Rect,
|
||||
|
||||
/// Tight bounding box around all the meshes in all the rows.
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ impl eframe::App for MyApp {
|
|||
// Collect dropped files:
|
||||
ctx.input(|i| {
|
||||
if !i.raw.dropped_files.is_empty() {
|
||||
self.dropped_files = i.raw.dropped_files.clone();
|
||||
self.dropped_files.clone_from(&i.raw.dropped_files);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue