Skip to content

Commit

Permalink
Merge pull request #455 from kas-gui/work
Browse files Browse the repository at this point in the history
Update thiserror, wgpu, resvg; Clippy
  • Loading branch information
dhardy authored Nov 30, 2024
2 parents 45424b2 + b023d4d commit e8d90f9
Show file tree
Hide file tree
Showing 17 changed files with 64 additions and 39 deletions.
7 changes: 6 additions & 1 deletion crates/kas-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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"
17 changes: 7 additions & 10 deletions crates/kas-core/src/event/cx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
_ => (),
}
}
}
Expand Down
15 changes: 7 additions & 8 deletions crates/kas-core/src/event/cx/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions crates/kas-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
6 changes: 3 additions & 3 deletions crates/kas-resvg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ 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 = "1.0.23"
thiserror = "2.0.3"

[dependencies.kas]
# We must rename this package since macros expect kas to be in scope:
Expand Down
1 change: 1 addition & 0 deletions crates/kas-resvg/src/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ fn load(data: &[u8], resources_dir: Option<&Path>) -> Result<Tree, usvg::Error>
image_href_resolver: Default::default(),
font_resolver: Default::default(),
fontdb: Default::default(),
style_sheet: None,
};

let tree = Tree::from_data(data, &opts)?;
Expand Down
5 changes: 5 additions & 0 deletions crates/kas-view/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
8 changes: 6 additions & 2 deletions crates/kas-wgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -47,9 +47,13 @@ path = "../kas-core"
version = "0.6.0"

[dependencies.wgpu]
version = "22.1.0"
version = "23.0.1"
default-features = false
features = ["spirv"]

[build-dependencies]
glob = "0.3"

[lints.clippy]
needless_lifetimes = "allow"
unit_arg = "allow"
4 changes: 2 additions & 2 deletions crates/kas-wgpu/src/draw/flat_round.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vertex>() as wgpu::BufferAddress,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions crates/kas-wgpu/src/draw/images.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Instance>() as wgpu::BufferAddress,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions crates/kas-wgpu/src/draw/round_2col.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vertex>() as wgpu::BufferAddress,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions crates/kas-wgpu/src/draw/shaded_round.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vertex>() as wgpu::BufferAddress,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions crates/kas-wgpu/src/draw/shaded_square.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vertex>() as wgpu::BufferAddress,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions crates/kas-wgpu/src/draw/text_pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Instance>() as wgpu::BufferAddress,
Expand All @@ -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,
Expand Down
11 changes: 10 additions & 1 deletion crates/kas-widgets/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,19 @@ 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"

# 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"
1 change: 1 addition & 0 deletions crates/kas-widgets/src/spinner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/mandlebrot/mandlebrot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vertex>() as wgpu::BufferAddress,
Expand All @@ -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,
Expand Down

0 comments on commit e8d90f9

Please sign in to comment.