Skip to content

Commit 55fea54

Browse files
committed
Fix some missed places that were using the old API, bump Rust version to allow use of if let guards
1 parent 4625e39 commit 55fea54

4 files changed

Lines changed: 16 additions & 5 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ homepage = "https://slint.dev"
123123
keywords = ["gui", "toolkit", "graphics", "design", "ui"]
124124
license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0"
125125
repository = "https://github.com/slint-ui/slint"
126-
rust-version = "1.92"
126+
rust-version = "1.95"
127127
version = "1.17.0"
128128

129129
[workspace.dependencies]

internal/core/graphics/image.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,8 +878,13 @@ impl Image {
878878
/// as new major WGPU releases become available.
879879
#[cfg(feature = "unstable-wgpu-27")]
880880
pub fn to_wgpu_27_texture(&self) -> Option<wgpu_27::Texture> {
881+
#[cfg_attr(not(feature = "unstable-wgpu-28"), expect(irrefutable_let_patterns))]
881882
match &self.0 {
882-
ImageInner::WGPUTexture(WGPUTexture::WGPU27Texture(texture)) => Some(texture.clone()),
883+
ImageInner::WGPUTexture(texture_rc)
884+
if WGPUTexture::WGPU27Texture(texture) = &**texture_rc =>
885+
{
886+
Some(texture.clone())
887+
}
883888
_ => None,
884889
}
885890
}

internal/core/graphics/wgpu_27.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ pub mod api {
130130
return Err(Self::Error::InvalidUsage);
131131
}
132132
Ok(Self(super::super::ImageInner::WGPUTexture(
133-
super::super::WGPUTexture::WGPU27Texture(texture),
133+
super::super::WGPUTexture::WGPU27Texture(texture).into(),
134134
)))
135135
}
136136
}

tests/cases/issues/issue_2608_canon_img_path.slint

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,16 @@ let img1_inner: &ImageInner = (&img1).into();
2020
let img2_inner: &ImageInner = (&img2).into();
2121
2222
match (img1_inner, img2_inner) {
23-
(ImageInner::EmbeddedImage { cache_key: ImageCacheKey::Path(img1_path), .. }, ImageInner::EmbeddedImage { cache_key: ImageCacheKey::Path(img2_path), .. }) => {
23+
(ImageInner::EmbeddedImage(img1), ImageInner::EmbeddedImage(img2))
24+
if let ImageCacheKey::Path(img1_path) = &img1.cache_key
25+
&& let ImageCacheKey::Path(img2_path) = &img2.cache_key =>
26+
{
2427
assert_eq!(img1_path, img2_path)
2528
},
26-
(ImageInner::EmbeddedImage { cache_key: ImageCacheKey::EmbeddedData(img1_addr), .. }, ImageInner::EmbeddedImage { cache_key: ImageCacheKey::EmbeddedData(img2_addr), .. }) => {
29+
(ImageInner::EmbeddedImage(img1), ImageInner::EmbeddedImage(img2))
30+
if let ImageCacheKey::EmbeddedData(img1_addr) = &img1.cache_key
31+
&& let ImageCacheKey::EmbeddedData(img2_addr) = &img2.cache_key =>
32+
{
2733
assert_eq!(img1_addr, img2_addr)
2834
},
2935
_ => todo!("adjust this test to new image comparison"),

0 commit comments

Comments
 (0)