From 832c6c4adf62d4f9cf8dbd47b63f0ed43fba044e Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Fri, 29 Nov 2024 18:03:37 +0000 Subject: [PATCH 1/5] Update to thiserror 2.0 --- crates/kas-core/Cargo.toml | 2 +- crates/kas-resvg/Cargo.toml | 2 +- crates/kas-wgpu/Cargo.toml | 2 +- crates/kas-widgets/Cargo.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/kas-core/Cargo.toml b/crates/kas-core/Cargo.toml index b1b93f18..971330ce 100644 --- a/crates/kas-core/Cargo.toml +++ b/crates/kas-core/Cargo.toml @@ -97,7 +97,7 @@ smallvec = "1.6.1" bitflags = "2.3.3" unicode-segmentation = "1.7" linear-map = "1.2.0" -thiserror = "1.0.23" +thiserror = "2.0.3" serde = { version = "1.0.123", features = ["derive"], optional = true } serde_json = { version = "1.0.61", optional = true } serde_yaml = { version = "0.9.9", optional = true } diff --git a/crates/kas-resvg/Cargo.toml b/crates/kas-resvg/Cargo.toml index 73fa3911..7384e39a 100644 --- a/crates/kas-resvg/Cargo.toml +++ b/crates/kas-resvg/Cargo.toml @@ -29,7 +29,7 @@ tiny-skia = { version = "0.11.0" } resvg = { version = "0.43.0", optional = true } usvg = { version = "0.43.0", optional = true } once_cell = "1.17.0" -thiserror = "1.0.23" +thiserror = "2.0.3" [dependencies.kas] # We must rename this package since macros expect kas to be in scope: diff --git a/crates/kas-wgpu/Cargo.toml b/crates/kas-wgpu/Cargo.toml index 4839afbe..a610e566 100644 --- a/crates/kas-wgpu/Cargo.toml +++ b/crates/kas-wgpu/Cargo.toml @@ -33,7 +33,7 @@ raster = ["kas-text/raster"] bytemuck = "1.7.0" futures-lite = "2.0" log = "0.4" -thiserror = "1.0.23" +thiserror = "2.0.3" guillotiere = "0.6.0" rustc-hash = "2.0" diff --git a/crates/kas-widgets/Cargo.toml b/crates/kas-widgets/Cargo.toml index e573b8db..25d77ea9 100644 --- a/crates/kas-widgets/Cargo.toml +++ b/crates/kas-widgets/Cargo.toml @@ -24,7 +24,7 @@ min_spec = [] log = "0.4" smallvec = "1.6.1" unicode-segmentation = "1.7" -thiserror = "1.0.23" +thiserror = "2.0.3" image = { version = "0.25.1", optional = true } kas-macros = { version = "0.14.1", path = "../kas-macros" } linear-map = "1.2.0" From 078350af759424d36b6e7b660fb4b630d03c126b Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Fri, 29 Nov 2024 18:07:37 +0000 Subject: [PATCH 2/5] Update wgpu to 23.0.1 --- crates/kas-wgpu/Cargo.toml | 2 +- crates/kas-wgpu/src/draw/flat_round.rs | 4 ++-- crates/kas-wgpu/src/draw/images.rs | 4 ++-- crates/kas-wgpu/src/draw/round_2col.rs | 4 ++-- crates/kas-wgpu/src/draw/shaded_round.rs | 4 ++-- crates/kas-wgpu/src/draw/shaded_square.rs | 4 ++-- crates/kas-wgpu/src/draw/text_pipe.rs | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/crates/kas-wgpu/Cargo.toml b/crates/kas-wgpu/Cargo.toml index a610e566..af92700a 100644 --- a/crates/kas-wgpu/Cargo.toml +++ b/crates/kas-wgpu/Cargo.toml @@ -47,7 +47,7 @@ path = "../kas-core" version = "0.6.0" [dependencies.wgpu] -version = "22.1.0" +version = "23.0.1" default-features = false features = ["spirv"] diff --git a/crates/kas-wgpu/src/draw/flat_round.rs b/crates/kas-wgpu/src/draw/flat_round.rs index 8b80745f..078d7100 100644 --- a/crates/kas-wgpu/src/draw/flat_round.rs +++ b/crates/kas-wgpu/src/draw/flat_round.rs @@ -67,7 +67,7 @@ impl Pipeline { layout: Some(&pipeline_layout), vertex: wgpu::VertexState { module: &shaders.vert_flat_round, - entry_point: "main", + entry_point: Some("main"), compilation_options: Default::default(), buffers: &[wgpu::VertexBufferLayout { array_stride: size_of::() as wgpu::BufferAddress, @@ -94,7 +94,7 @@ impl Pipeline { multisample: Default::default(), fragment: Some(wgpu::FragmentState { module: &shaders.frag_flat_round, - entry_point: "main", + entry_point: Some("main"), compilation_options: Default::default(), targets: &[Some(wgpu::ColorTargetState { format: super::RENDER_TEX_FORMAT, diff --git a/crates/kas-wgpu/src/draw/images.rs b/crates/kas-wgpu/src/draw/images.rs index 7364cd62..c13bd27d 100644 --- a/crates/kas-wgpu/src/draw/images.rs +++ b/crates/kas-wgpu/src/draw/images.rs @@ -94,7 +94,7 @@ impl Images { wgpu::TextureFormat::Rgba8UnormSrgb, wgpu::VertexState { module: &shaders.vert_image, - entry_point: "main", + entry_point: Some("main"), compilation_options: Default::default(), buffers: &[wgpu::VertexBufferLayout { array_stride: size_of::() as wgpu::BufferAddress, @@ -109,7 +109,7 @@ impl Images { }, wgpu::FragmentState { module: &shaders.frag_image, - entry_point: "main", + entry_point: Some("main"), compilation_options: Default::default(), targets: &[Some(wgpu::ColorTargetState { format: super::RENDER_TEX_FORMAT, diff --git a/crates/kas-wgpu/src/draw/round_2col.rs b/crates/kas-wgpu/src/draw/round_2col.rs index 54d33851..9ccd9dde 100644 --- a/crates/kas-wgpu/src/draw/round_2col.rs +++ b/crates/kas-wgpu/src/draw/round_2col.rs @@ -56,7 +56,7 @@ impl Pipeline { layout: Some(&pipeline_layout), vertex: wgpu::VertexState { module: &shaders.vert_round_2col, - entry_point: "main", + entry_point: Some("main"), compilation_options: Default::default(), buffers: &[wgpu::VertexBufferLayout { array_stride: size_of::() as wgpu::BufferAddress, @@ -82,7 +82,7 @@ impl Pipeline { multisample: Default::default(), fragment: Some(wgpu::FragmentState { module: &shaders.frag_round_2col, - entry_point: "main", + entry_point: Some("main"), compilation_options: Default::default(), targets: &[Some(wgpu::ColorTargetState { format: super::RENDER_TEX_FORMAT, diff --git a/crates/kas-wgpu/src/draw/shaded_round.rs b/crates/kas-wgpu/src/draw/shaded_round.rs index 1ebcc5f3..350f2029 100644 --- a/crates/kas-wgpu/src/draw/shaded_round.rs +++ b/crates/kas-wgpu/src/draw/shaded_round.rs @@ -62,7 +62,7 @@ impl Pipeline { layout: Some(&pipeline_layout), vertex: wgpu::VertexState { module: &shaders.vert_shaded_round, - entry_point: "main", + entry_point: Some("main"), compilation_options: Default::default(), buffers: &[wgpu::VertexBufferLayout { array_stride: size_of::() as wgpu::BufferAddress, @@ -89,7 +89,7 @@ impl Pipeline { multisample: Default::default(), fragment: Some(wgpu::FragmentState { module: &shaders.frag_shaded_round, - entry_point: "main", + entry_point: Some("main"), compilation_options: Default::default(), targets: &[Some(wgpu::ColorTargetState { format: super::RENDER_TEX_FORMAT, diff --git a/crates/kas-wgpu/src/draw/shaded_square.rs b/crates/kas-wgpu/src/draw/shaded_square.rs index 1cbd9795..a3c79bc9 100644 --- a/crates/kas-wgpu/src/draw/shaded_square.rs +++ b/crates/kas-wgpu/src/draw/shaded_square.rs @@ -49,7 +49,7 @@ impl Pipeline { layout: Some(&pipeline_layout), vertex: wgpu::VertexState { module: &shaders.vert_shaded_square, - entry_point: "main", + entry_point: Some("main"), compilation_options: Default::default(), buffers: &[wgpu::VertexBufferLayout { array_stride: size_of::() as wgpu::BufferAddress, @@ -74,7 +74,7 @@ impl Pipeline { multisample: Default::default(), fragment: Some(wgpu::FragmentState { module: &shaders.frag_shaded_square, - entry_point: "main", + entry_point: Some("main"), compilation_options: Default::default(), targets: &[Some(wgpu::ColorTargetState { format: super::RENDER_TEX_FORMAT, diff --git a/crates/kas-wgpu/src/draw/text_pipe.rs b/crates/kas-wgpu/src/draw/text_pipe.rs index a31efcdb..bb872d62 100644 --- a/crates/kas-wgpu/src/draw/text_pipe.rs +++ b/crates/kas-wgpu/src/draw/text_pipe.rs @@ -95,7 +95,7 @@ impl Pipeline { wgpu::TextureFormat::R8Unorm, wgpu::VertexState { module: &shaders.vert_glyph, - entry_point: "main", + entry_point: Some("main"), compilation_options: Default::default(), buffers: &[wgpu::VertexBufferLayout { array_stride: size_of::() as wgpu::BufferAddress, @@ -111,7 +111,7 @@ impl Pipeline { }, wgpu::FragmentState { module: &shaders.frag_glyph, - entry_point: "main", + entry_point: Some("main"), compilation_options: Default::default(), targets: &[Some(wgpu::ColorTargetState { format: super::RENDER_TEX_FORMAT, From 9e37c5c2f3e8bc117961e19b5b63588983d7f028 Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Fri, 29 Nov 2024 18:16:18 +0000 Subject: [PATCH 3/5] Update to resvg 0.44 --- crates/kas-resvg/Cargo.toml | 4 ++-- crates/kas-resvg/src/svg.rs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/kas-resvg/Cargo.toml b/crates/kas-resvg/Cargo.toml index 7384e39a..816cf638 100644 --- a/crates/kas-resvg/Cargo.toml +++ b/crates/kas-resvg/Cargo.toml @@ -26,8 +26,8 @@ svg = ["dep:resvg", "dep:usvg"] [dependencies] tiny-skia = { version = "0.11.0" } -resvg = { version = "0.43.0", optional = true } -usvg = { version = "0.43.0", optional = true } +resvg = { version = "0.44.0", optional = true } +usvg = { version = "0.44.0", optional = true } once_cell = "1.17.0" thiserror = "2.0.3" diff --git a/crates/kas-resvg/src/svg.rs b/crates/kas-resvg/src/svg.rs index c36b95a7..c65f89b5 100644 --- a/crates/kas-resvg/src/svg.rs +++ b/crates/kas-resvg/src/svg.rs @@ -50,6 +50,7 @@ fn load(data: &[u8], resources_dir: Option<&Path>) -> Result image_href_resolver: Default::default(), font_resolver: Default::default(), fontdb: Default::default(), + style_sheet: None, }; let tree = Tree::from_data(data, &opts)?; From 8fcd01dd52c8c98488e219de964146ce6a3b73ef Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Fri, 29 Nov 2024 18:47:15 +0000 Subject: [PATCH 4/5] Clippy --- crates/kas-core/Cargo.toml | 5 +++++ crates/kas-core/src/event/cx/mod.rs | 17 +++++++---------- crates/kas-core/src/event/cx/platform.rs | 15 +++++++-------- crates/kas-macros/Cargo.toml | 4 ++++ crates/kas-view/Cargo.toml | 5 +++++ crates/kas-wgpu/Cargo.toml | 4 ++++ crates/kas-widgets/Cargo.toml | 9 +++++++++ crates/kas-widgets/src/spinner.rs | 1 + 8 files changed, 42 insertions(+), 18 deletions(-) diff --git a/crates/kas-core/Cargo.toml b/crates/kas-core/Cargo.toml index 971330ce..87337304 100644 --- a/crates/kas-core/Cargo.toml +++ b/crates/kas-core/Cargo.toml @@ -134,3 +134,8 @@ version = "0.30.1" optional = true default-features = false features = ["rwh_06"] + +[lints.clippy] +module_inception = "allow" +needless_lifetimes = "allow" +unit_arg = "allow" diff --git a/crates/kas-core/src/event/cx/mod.rs b/crates/kas-core/src/event/cx/mod.rs index 530ef4a8..e2b1dddf 100644 --- a/crates/kas-core/src/event/cx/mod.rs +++ b/crates/kas-core/src/event/cx/mod.rs @@ -84,19 +84,16 @@ struct MouseGrab { impl<'a> EventCx<'a> { fn flush_mouse_grab_motion(&mut self) { if let Some(grab) = self.mouse_grab.as_mut() { - match grab.details { - GrabDetails::Click { ref cur_id } => { - if grab.start_id == cur_id { - if grab.depress != *cur_id { - grab.depress = cur_id.clone(); - self.action |= Action::REDRAW; - } - } else if grab.depress.is_some() { - grab.depress = None; + if let GrabDetails::Click { ref cur_id } = grab.details { + if grab.start_id == cur_id { + if grab.depress != *cur_id { + grab.depress = cur_id.clone(); self.action |= Action::REDRAW; } + } else if grab.depress.is_some() { + grab.depress = None; + self.action |= Action::REDRAW; } - _ => (), } } } diff --git a/crates/kas-core/src/event/cx/platform.rs b/crates/kas-core/src/event/cx/platform.rs index d976c396..8e33fe5f 100644 --- a/crates/kas-core/src/event/cx/platform.rs +++ b/crates/kas-core/src/event/cx/platform.rs @@ -371,14 +371,13 @@ impl<'a> EventCx<'a> { // TODO(winit): https://github.com/rust-windowing/winit/issues/3038 let mut mods = self.modifiers; mods.remove(ModifiersState::SHIFT); - if !mods.is_empty() { - event.text = None; - } else if event - .text - .as_ref() - .and_then(|t| t.chars().next()) - .map(|c| c.is_control()) - .unwrap_or(false) + if !mods.is_empty() + || event + .text + .as_ref() + .and_then(|t| t.chars().next()) + .map(|c| c.is_control()) + .unwrap_or(false) { event.text = None; } diff --git a/crates/kas-macros/Cargo.toml b/crates/kas-macros/Cargo.toml index f7548117..1a4314e4 100644 --- a/crates/kas-macros/Cargo.toml +++ b/crates/kas-macros/Cargo.toml @@ -39,3 +39,7 @@ features = ["extra-traits", "full", "visit", "visit-mut"] [build-dependencies] version_check = "0.9" + +[lints.clippy] +collapsible_else_if = "allow" +unit_arg = "allow" diff --git a/crates/kas-view/Cargo.toml b/crates/kas-view/Cargo.toml index 361d719a..785b70f7 100644 --- a/crates/kas-view/Cargo.toml +++ b/crates/kas-view/Cargo.toml @@ -23,3 +23,8 @@ linear-map = "1.2.0" # We must rename this package since macros expect kas to be in scope: kas = { version = "0.14.1", package = "kas-core", path = "../kas-core" } + +[lints.clippy] +collapsible_else_if = "allow" +needless_lifetimes = "allow" +unit_arg = "allow" diff --git a/crates/kas-wgpu/Cargo.toml b/crates/kas-wgpu/Cargo.toml index af92700a..b61084a4 100644 --- a/crates/kas-wgpu/Cargo.toml +++ b/crates/kas-wgpu/Cargo.toml @@ -53,3 +53,7 @@ features = ["spirv"] [build-dependencies] glob = "0.3" + +[lints.clippy] +needless_lifetimes = "allow" +unit_arg = "allow" diff --git a/crates/kas-widgets/Cargo.toml b/crates/kas-widgets/Cargo.toml index 25d77ea9..3844b794 100644 --- a/crates/kas-widgets/Cargo.toml +++ b/crates/kas-widgets/Cargo.toml @@ -31,3 +31,12 @@ linear-map = "1.2.0" # We must rename this package since macros expect kas to be in scope: kas = { version = "0.14.1", package = "kas-core", path = "../kas-core" } + +[lints.clippy] +collapsible_else_if = "allow" +collapsible_if = "allow" +comparison_chain = "allow" +module_inception = "allow" +needless_lifetimes = "allow" +redundant_pattern_matching = "allow" +unit_arg = "allow" diff --git a/crates/kas-widgets/src/spinner.rs b/crates/kas-widgets/src/spinner.rs index 57021b7f..83bcb354 100644 --- a/crates/kas-widgets/src/spinner.rs +++ b/crates/kas-widgets/src/spinner.rs @@ -67,6 +67,7 @@ macro_rules! impl_int { ((self / step).saturating_add(1)).saturating_mul(step).min(u_bound) } fn sub_step(self, step: Self, l_bound: Self) -> Self { + #[allow(clippy::manual_div_ceil)] // only stable on a subset of types used (((self + step - 1) / step).saturating_sub(1)).saturating_mul(step).max(l_bound) } } From b023d4d2994d051ac63ba75228451590f361245d Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Fri, 29 Nov 2024 19:23:11 +0000 Subject: [PATCH 5/5] Fix mandlebrot --- examples/mandlebrot/mandlebrot.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/mandlebrot/mandlebrot.rs b/examples/mandlebrot/mandlebrot.rs index e1110bc1..73845c2b 100644 --- a/examples/mandlebrot/mandlebrot.rs +++ b/examples/mandlebrot/mandlebrot.rs @@ -133,7 +133,7 @@ impl CustomPipeBuilder for PipeBuilder { layout: Some(&pipeline_layout), vertex: wgpu::VertexState { module: &shaders.vertex, - entry_point: "main", + entry_point: Some("main"), compilation_options: Default::default(), buffers: &[wgpu::VertexBufferLayout { array_stride: size_of::() as wgpu::BufferAddress, @@ -154,7 +154,7 @@ impl CustomPipeBuilder for PipeBuilder { multisample: Default::default(), fragment: Some(wgpu::FragmentState { module: &shaders.fragment, - entry_point: "main", + entry_point: Some("main"), compilation_options: Default::default(), targets: &[Some(wgpu::ColorTargetState { format: tex_format,