Skip to content

Commit

Permalink
Make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmerlin committed Aug 18, 2023
1 parent 3f53953 commit 4fdcce0
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 20 deletions.
1 change: 1 addition & 0 deletions crates/egui_animation/examples/animations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use egui_animation::{animate_ui_translation, Collapse};
use hello_egui_utils::measure_text;
use rand::seq::SliceRandom;

#[allow(clippy::type_complexity)]
const EASINGS: [(fn(f32) -> f32, &str); 31] = [
(simple_easing::cubic_in_out, "Cubic in-out"),
(simple_easing::cubic_in, "Cubic in"),
Expand Down
2 changes: 2 additions & 0 deletions crates/egui_animation/src/collapse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use crate::animate_bool_eased;
use egui::{Id, Rect, Ui, Vec2};

pub struct Collapse {
// TODO: Implement horizontal collapse
#[allow(dead_code)]
horizontal: bool,
visible: bool,
id: Id,
Expand Down
4 changes: 1 addition & 3 deletions crates/egui_animation/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
mod collapse;


use std::fmt::Debug;
use std::hash::Hash;


pub use collapse::*;
use egui::{Context, Id, Pos2, Rect, Sense, Ui, Vec2};
use egui_goodies_utils::current_scroll_delta;
use hello_egui_utils::current_scroll_delta;

#[derive(Debug, Clone)]
struct AnimationState {
Expand Down
10 changes: 5 additions & 5 deletions crates/egui_infinite_scroll/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use std::ops::Range;

use egui::Ui;

#[cfg(feature = "egui_extras")]
use egui_extras::{TableBody, TableRow};
use egui_inbox::UiInbox;
use egui_virtual_list::{VirtualList, VirtualListResponse};

Expand Down Expand Up @@ -298,14 +300,12 @@ impl<T: Debug + Send + Sync + 'static, Cursor: Clone + Debug + Send + 'static>
#[cfg(feature = "egui_extras")]
pub fn ui_table(
&mut self,
table: TableBody,
mut table: TableBody,
prefetch_count: usize,
row_height: f32,
mut row_ui: impl FnMut(TableRow, &mut T),
) {
use egui_extras::{TableBody, TableRow};

self.read_inboxes();
self.read_inboxes(table.ui_mut());

let mut min_item = 0;
let mut max_item = 0;
Expand All @@ -318,6 +318,6 @@ impl<T: Debug + Send + Sync + 'static, Cursor: Clone + Debug + Send + 'static>
});

let item_range = min_item..max_item;
self.update_items(item_range, prefetch_count);
self.update_items(&item_range, prefetch_count);
}
}
14 changes: 7 additions & 7 deletions crates/egui_taffy/examples/taffy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub fn main() -> eframe::Result<()> {
},
Layout::centered_and_justified(Direction::TopDown),
|ui| {
ui.button("Button 2 With long text");
let _ = ui.button("Button 2 With long text");
},
);

Expand Down Expand Up @@ -112,7 +112,7 @@ pub fn main() -> eframe::Result<()> {
},
Layout::centered_and_justified(Direction::TopDown),
|ui| {
ui.button("Button 1");
let _ = ui.button("Button 1");
},
);
taffy.add(
Expand All @@ -123,7 +123,7 @@ pub fn main() -> eframe::Result<()> {
},
Layout::centered_and_justified(Direction::TopDown),
|ui| {
ui.button("Button 2 With long text");
let _ = ui.button("Button 2 With long text");
},
);
},
Expand All @@ -137,8 +137,8 @@ pub fn main() -> eframe::Result<()> {
},
Layout::top_down(Align::Center),
|ui| {
ui.button("Button 1");
ui.button("Button 2");
let _ = ui.button("Button 1");
let _ = ui.button("Button 2");
},
);
taffy.add(
Expand All @@ -154,7 +154,7 @@ pub fn main() -> eframe::Result<()> {
},
Layout::centered_and_justified(Direction::TopDown),
|ui| {
ui.button("Button 2");
let _ = ui.button("Button 2");
},
);
taffy.show();
Expand Down Expand Up @@ -191,7 +191,7 @@ pub fn main() -> eframe::Result<()> {
},
Layout::centered_and_justified(Direction::TopDown),
move |ui| {
ui.button(button);
let _ = ui.button(button);
},
);
}
Expand Down
8 changes: 3 additions & 5 deletions crates/egui_taffy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ type Node = NodeId;

struct TaffyState {
taffy: Taffy<MeasureFunc<&'static mut Vec<Option<ContentFn<'static>>>>>,
ctx: Context,

children: Vec<EguiTaffyNode>,

Expand All @@ -29,14 +28,13 @@ unsafe impl Send for TaffyState {}
unsafe impl Sync for TaffyState {}

impl TaffyState {
pub fn new(ctx: Context) -> Self {
pub fn new() -> Self {
let mut taffy = Taffy::new();

Self {
root_node: taffy.new_with_children(Style::default(), &[]).unwrap(),
node_style: Style::default(),
taffy,
ctx,
children: Vec::new(),
last_size: egui::Vec2::ZERO,
}
Expand All @@ -62,7 +60,7 @@ pub struct TaffyPass<'a> {

ui: &'a mut Ui,

content_fns: Vec<Option<Box<dyn FnMut(&mut Ui) + Send + 'a>>>,
content_fns: Vec<Option<ContentFn<'a>>>,

current_node: Node,
current_node_index: usize,
Expand All @@ -73,7 +71,7 @@ pub struct TaffyPass<'a> {
impl<'a> TaffyPass<'a> {
fn with_state<T>(id: Id, ctx: Context, f: impl FnOnce(&mut TaffyState) -> T) -> T {
ctx.data_mut(|data: &mut IdTypeMap| {
let data = data.get_temp_mut_or_insert_with(id, || TaffyState::new(ctx.clone()));
let data = data.get_temp_mut_or_insert_with(id, TaffyState::new);

f(data)
})
Expand Down

0 comments on commit 4fdcce0

Please sign in to comment.