Skip to content

Commit

Permalink
fixed clippy; updated depdendencies
Browse files Browse the repository at this point in the history
  • Loading branch information
PsichiX committed Dec 5, 2024
1 parent 691fd4b commit 6e8807e
Show file tree
Hide file tree
Showing 26 changed files with 53 additions and 56 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "raui"
version = "0.64.0"
version = "0.64.1"
authors = ["Patryk 'PsichiX' Budzynski <[email protected]>"]
edition = "2021"
description = "Renderer Agnostic User Interface"
Expand Down
2 changes: 1 addition & 1 deletion demos/in-game/src/model/inventory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl Inventory {
pub fn owned<'a>(
&'a self,
database: &'a ItemsDatabase,
) -> impl Iterator<Item = (&str, usize, &Item)> {
) -> impl Iterator<Item = (&'a str, usize, &'a Item)> {
self.owned
.iter()
.filter_map(|(id, count)| Some((id.as_str(), *count, database.items.get(id)?)))
Expand Down
2 changes: 1 addition & 1 deletion examples/context_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn app(mut ctx: WidgetContext) -> WidgetNode {

make_widget!(content_box)
.idref(idref.clone())
.with_shared_props(PortalsContainer(idref.into()))
.with_shared_props(PortalsContainer(idref))
.listed_slot(
make_widget!(horizontal_box)
.with_props(HorizontalBoxProps {
Expand Down
2 changes: 1 addition & 1 deletion examples/immediate_mode_stack_props.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,5 @@ mod gui {
}

fn main() {
ImmediateApp::simple("Immediate mode UI - Stack props", || gui::app());
ImmediateApp::simple("Immediate mode UI - Stack props", gui::app);
}
2 changes: 1 addition & 1 deletion examples/options_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn app(mut ctx: WidgetContext) -> WidgetNode {
// for option views to anchor thier content into.
make_widget!(content_box)
.idref(idref.clone())
.with_shared_props(PortalsContainer(idref.into()))
.with_shared_props(PortalsContainer(idref))
.listed_slot(
// Options view is basically a button that toggles its content anchored
// to itself. You can think of dropdown/context menus, but actually it
Expand Down
2 changes: 1 addition & 1 deletion examples/options_view_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn app(mut ctx: WidgetContext) -> WidgetNode {

make_widget!(content_box)
.idref(idref.clone())
.with_shared_props(PortalsContainer(idref.into()))
.with_shared_props(PortalsContainer(idref))
.listed_slot(
make_widget!(options_view)
.with_props(ContentBoxItemLayout {
Expand Down
2 changes: 1 addition & 1 deletion examples/portal_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn app(mut ctx: WidgetContext) -> WidgetNode {
.idref(idref.clone())
// widget rederence marked as portals container and put into root shared props for any
// portal box down the widget tree. More about how portal box works later.
.with_shared_props(PortalsContainer(idref.to_owned().into()))
.with_shared_props(PortalsContainer(idref.to_owned()))
.listed_slot(
make_widget!(anchor_box)
.with_props(RelativeLayoutProps {
Expand Down
2 changes: 1 addition & 1 deletion examples/retained_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,5 +250,5 @@ fn create_app(notifier: ChangeNotifier) -> View<AppView> {
}

fn main() {
RetainedApp::simple("Retained mode UI", |notifier| create_app(notifier));
RetainedApp::simple("Retained mode UI", create_app);
}
7 changes: 2 additions & 5 deletions examples/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ fn main() {
// tree.
application.apply(tree);

// This and the following function calls would need to be called every frame
loop {
// This scope content would need to be called every frame
{
// Telling the app to `process` will make it perform any necessary updates.
application.process();

Expand Down Expand Up @@ -73,8 +73,5 @@ fn main() {
.render::<_, String, _>(&mapping, &mut renderer)
.unwrap()
);

// Let's not actually loop infinitely for this example
break;
}
}
2 changes: 1 addition & 1 deletion examples/tooltip_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn app(mut ctx: WidgetContext) -> WidgetNode {

make_widget!(content_box)
.idref(idref.clone())
.with_shared_props(PortalsContainer(idref.into()))
.with_shared_props(PortalsContainer(idref))
.listed_slot(
make_widget!(horizontal_box)
.with_props(HorizontalBoxProps {
Expand Down
2 changes: 1 addition & 1 deletion raui-app/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "raui-app"
version = "0.64.0"
version = "0.64.1"
authors = ["Patryk 'PsichiX' Budzynski <[email protected]>"]
edition = "2021"
description = "RAUI application layer to focus only on making UI"
Expand Down
2 changes: 1 addition & 1 deletion raui-app/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ pub(crate) struct TesselateToGraphics<'a> {
projection_view_matrix: [f32; 16],
}

impl<'a> TesselateBatchConverter<GraphicsBatch> for TesselateToGraphics<'a> {
impl TesselateBatchConverter<GraphicsBatch> for TesselateToGraphics<'_> {
fn convert(&mut self, batch: TesselateBatch) -> Option<GraphicsBatch> {
match batch {
TesselateBatch::Color => Some(GraphicsBatch {
Expand Down
4 changes: 2 additions & 2 deletions raui-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "raui-core"
version = "0.64.0"
version = "0.64.1"
authors = ["Patryk 'PsichiX' Budzynski <[email protected]>"]
edition = "2021"
description = "RAUI application layer"
Expand All @@ -14,4 +14,4 @@ categories = ["gui", "rendering::graphics-api"]
raui-derive = { version = "0.64", path = "../raui-derive" }
serde = { version = "1", features = ["derive"] }
serde_json = "1.0"
intuicio-data = "0.33"
intuicio-data = "0.39"
2 changes: 1 addition & 1 deletion raui-core/src/layout/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl<'a> LayoutSortedItems<'a> {
}
}

impl<'a> std::fmt::Debug for LayoutSortedItems<'a> {
impl std::fmt::Debug for LayoutSortedItems<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_map()
.entries(self.0.iter().map(|&(k, v)| (k, v)))
Expand Down
10 changes: 5 additions & 5 deletions raui-core/src/view_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ pub struct ViewModelObject<'a, T> {
notifier: ViewModelNotifier,
}

impl<'a, T> ViewModelObject<'a, T> {
impl<T> ViewModelObject<'_, T> {
pub fn set_unique_notify(&mut self, value: T)
where
T: PartialEq,
Expand All @@ -435,15 +435,15 @@ impl<'a, T> ViewModelObject<'a, T> {
}
}

impl<'a, T> Deref for ViewModelObject<'a, T> {
impl<T> Deref for ViewModelObject<'_, T> {
type Target = T;

fn deref(&self) -> &Self::Target {
&self.access
}
}

impl<'a, T> DerefMut for ViewModelObject<'a, T> {
impl<T> DerefMut for ViewModelObject<'_, T> {
fn deref_mut(&mut self) -> &mut Self::Target {
self.notifier.notify();
&mut self.access
Expand Down Expand Up @@ -534,9 +534,9 @@ mod tests {
collection.insert(FOO_VIEW_MODEL.to_owned(), view_model);

// unbound properties won't trigger notification until we bind widgets to them.
assert_eq!(collection.consume_notified_common_root().is_valid(), false);
assert!(!collection.consume_notified_common_root().is_valid());
handle.write().unwrap().toggle();
assert_eq!(collection.consume_notified_common_root().is_valid(), false);
assert!(!collection.consume_notified_common_root().is_valid());
assert!(collection
.get_mut(FOO_VIEW_MODEL)
.unwrap()
Expand Down
4 changes: 2 additions & 2 deletions raui-core/src/widget/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct WidgetContext<'a> {
pub view_models: ViewModelCollectionView<'a>,
}

impl<'a> WidgetContext<'a> {
impl WidgetContext<'_> {
pub fn take_named_slots(&mut self) -> HashMap<String, WidgetNode> {
std::mem::take(&mut self.named_slots)
}
Expand All @@ -45,7 +45,7 @@ impl<'a> WidgetContext<'a> {
}
}

impl<'a> std::fmt::Debug for WidgetContext<'a> {
impl std::fmt::Debug for WidgetContext<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("WidgetContext")
.field("id", &self.id)
Expand Down
42 changes: 21 additions & 21 deletions raui-core/src/widget/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub struct WidgetIdMetaParam<'a> {
pub value: Option<&'a str>,
}

impl<'a> WidgetIdMetaParam<'a> {
impl WidgetIdMetaParam<'_> {
pub fn is_flag(&self) -> bool {
self.value.is_none()
}
Expand Down Expand Up @@ -1098,52 +1098,52 @@ mod tests {
let a = WidgetId::from_str("a:root/a/b/c").unwrap();
let b = WidgetId::from_str("b:root/a/b/c").unwrap();
assert_eq!(a.distance_to(&b), Ok(0));
assert_eq!(a.is_subset_of(&b), false);
assert_eq!(a.is_superset_of(&b), false);
assert!(!a.is_subset_of(&b));
assert!(!a.is_superset_of(&b));
let a = WidgetId::from_str("a:root/a/b").unwrap();
let b = WidgetId::from_str("b:root/a/b/c").unwrap();
assert_eq!(a.distance_to(&b), Ok(-1));
assert_eq!(a.is_subset_of(&b), true);
assert_eq!(a.is_superset_of(&b), false);
assert!(a.is_subset_of(&b));
assert!(!a.is_superset_of(&b));
let a = WidgetId::from_str("a:root/a").unwrap();
let b = WidgetId::from_str("b:root/a/b/c").unwrap();
assert_eq!(a.distance_to(&b), Ok(-2));
assert_eq!(a.is_subset_of(&b), true);
assert_eq!(a.is_superset_of(&b), false);
assert!(a.is_subset_of(&b));
assert!(!a.is_superset_of(&b));
let a = WidgetId::from_str("a:root").unwrap();
let b = WidgetId::from_str("b:root/a/b/c").unwrap();
assert_eq!(a.distance_to(&b), Ok(-3));
assert_eq!(a.is_subset_of(&b), true);
assert_eq!(a.is_superset_of(&b), false);
assert!(a.is_subset_of(&b));
assert!(!a.is_superset_of(&b));
let a = WidgetId::from_str("a:root/a/b/c").unwrap();
let b = WidgetId::from_str("b:root/a/b").unwrap();
assert_eq!(a.distance_to(&b), Ok(1));
assert_eq!(a.is_subset_of(&b), false);
assert_eq!(a.is_superset_of(&b), true);
assert!(!a.is_subset_of(&b));
assert!(a.is_superset_of(&b));
let a = WidgetId::from_str("a:root/a/b/c").unwrap();
let b = WidgetId::from_str("b:root/a").unwrap();
assert_eq!(a.distance_to(&b), Ok(2));
assert_eq!(a.is_subset_of(&b), false);
assert_eq!(a.is_superset_of(&b), true);
assert!(!a.is_subset_of(&b));
assert!(a.is_superset_of(&b));
let a = WidgetId::from_str("a:root/a/b/c").unwrap();
let b = WidgetId::from_str("b:root").unwrap();
assert_eq!(a.distance_to(&b), Ok(3));
assert_eq!(a.is_subset_of(&b), false);
assert_eq!(a.is_superset_of(&b), true);
assert!(!a.is_subset_of(&b));
assert!(a.is_superset_of(&b));
let a = WidgetId::from_str("a:root/a/b/x").unwrap();
let b = WidgetId::from_str("b:root/a/b/c").unwrap();
assert_eq!(a.distance_to(&b), Err(-1));
assert_eq!(a.is_subset_of(&b), false);
assert_eq!(a.is_superset_of(&b), false);
assert!(!a.is_subset_of(&b));
assert!(!a.is_superset_of(&b));
let a = WidgetId::from_str("a:root/a/x/y").unwrap();
let b = WidgetId::from_str("b:root/a/b/c").unwrap();
assert_eq!(a.distance_to(&b), Err(-2));
assert_eq!(a.is_subset_of(&b), false);
assert_eq!(a.is_superset_of(&b), false);
assert!(!a.is_subset_of(&b));
assert!(!a.is_superset_of(&b));
let a = WidgetId::from_str("a:root/x/y/z").unwrap();
let b = WidgetId::from_str("b:root/a/b/c").unwrap();
assert_eq!(a.distance_to(&b), Err(-3));
assert_eq!(a.is_subset_of(&b), false);
assert_eq!(a.is_superset_of(&b), false);
assert!(!a.is_subset_of(&b));
assert!(!a.is_superset_of(&b));
}
}
2 changes: 1 addition & 1 deletion raui-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "raui-derive"
version = "0.64.0"
version = "0.64.1"
authors = ["Patryk 'PsichiX' Budzynski <[email protected]>"]
edition = "2021"
description = "Macros for Renderer Agnostic User Interface"
Expand Down
2 changes: 1 addition & 1 deletion raui-immediate-widgets/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "raui-immediate-widgets"
version = "0.64.0"
version = "0.64.1"
authors = ["Patryk 'PsichiX' Budzynski <[email protected]>"]
edition = "2021"
description = "Widgets library for RAUI immediate mode UI layer"
Expand Down
2 changes: 1 addition & 1 deletion raui-immediate/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "raui-immediate"
version = "0.64.0"
version = "0.64.1"
authors = ["Patryk 'PsichiX' Budzynski <[email protected]>"]
edition = "2021"
description = "RAUI immediate mode UI layer"
Expand Down
2 changes: 1 addition & 1 deletion raui-immediate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ mod tests {
}

fn text_field() {
let text = use_state(|| String::default());
let text = use_state(String::default);
let mut text = text.write().unwrap();

text.push('z');
Expand Down
2 changes: 1 addition & 1 deletion raui-json-renderer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "raui-json-renderer"
version = "0.64.0"
version = "0.64.1"
authors = ["Patryk 'PsichiX' Budzynski <[email protected]>"]
edition = "2021"
description = "RAUI renderer for JSON format"
Expand Down
2 changes: 1 addition & 1 deletion raui-material/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "raui-material"
version = "0.64.0"
version = "0.64.1"
authors = ["Patryk 'PsichiX' Budzynski <[email protected]>"]
edition = "2021"
description = "Material components library for RAUI"
Expand Down
2 changes: 1 addition & 1 deletion raui-retained/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "raui-retained"
version = "0.64.0"
version = "0.64.1"
authors = ["Patryk 'PsichiX' Budzynski <[email protected]>"]
edition = "2021"
description = "RAUI retained mode UI layer"
Expand Down
2 changes: 1 addition & 1 deletion raui-tesselate-renderer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "raui-tesselate-renderer"
version = "0.64.0"
version = "0.64.1"
authors = ["Patryk 'PsichiX' Budzynski <[email protected]>"]
edition = "2021"
description = "RAUI renderer that tesselates layout into vertex and index buffers"
Expand Down
2 changes: 1 addition & 1 deletion raui-tesselate-renderer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ where
}
}

impl<'a, V, B, P, C> Renderer<(), Error> for TesselateRenderer<'a, V, B, P, C>
impl<V, B, P, C> Renderer<(), Error> for TesselateRenderer<'_, V, B, P, C>
where
V: TesselateVertex + TextVertex<Color> + Default,
B: PartialEq,
Expand Down

0 comments on commit 6e8807e

Please sign in to comment.