Skip to content

Commit ec26508

Browse files
committed
change unreachable Err handling
1 parent 5bb4db7 commit ec26508

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

crates/cargo-gpu/src/install.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ use std::path::{Path, PathBuf};
1212

1313
/// Represents a functional backend installation, whether it was cached or just installed.
1414
#[derive(Clone, Debug)]
15-
#[expect(
16-
clippy::exhaustive_structs,
17-
reason = "never adding private members to this struct"
18-
)]
15+
#[non_exhaustive]
1916
pub struct InstalledBackend {
2017
/// path to the `rustc_codegen_spirv` dylib
2118
pub rustc_codegen_spirv_location: PathBuf,
@@ -28,9 +25,8 @@ pub struct InstalledBackend {
2825
impl InstalledBackend {
2926
/// Creates a new `SpirvBuilder` configured to use this installed backend.
3027
#[expect(
31-
clippy::missing_panics_doc,
32-
clippy::expect_used,
33-
reason = "unreachable"
28+
clippy::unreachable,
29+
reason = "it's unreachable, no need to return a Result"
3430
)]
3531
#[expect(clippy::impl_trait_in_params, reason = "forwarding spirv-builder API")]
3632
#[inline]
@@ -40,8 +36,11 @@ impl InstalledBackend {
4036
target: impl Into<String>,
4137
) -> SpirvBuilder {
4238
let mut builder = SpirvBuilder::new(path_to_crate, target);
43-
self.configure_spirv_builder(&mut builder)
44-
.expect("unreachable");
39+
let result = self.configure_spirv_builder(&mut builder);
40+
match result {
41+
Ok(()) => (),
42+
Err(_) => unreachable!("we set target before calling this function"),
43+
}
4544
builder
4645
}
4746

0 commit comments

Comments
 (0)