Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions crates/k8s-version/src/level/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,18 @@ pub enum Level {
impl FromStr for Level {
type Err = ParseLevelError;

// SAFETY: We purposefully allow the `clippy::unwrap_in_result` lint below in this function.
// We can use expect here, because the correct match labels must be used.
//
// FIXME (@Techassi): This attribute can be used on individual unwrap and expect calls since
// Rust 1.91.0. We should move this attribute to not contaminate an unnecessarily large scope
// once we bump the toolchain to 1.91.0.
// See https://github.com/rust-lang/rust-clippy/pull/15445
#[allow(clippy::unwrap_in_result)]
fn from_str(input: &str) -> Result<Self, Self::Err> {
let captures = LEVEL_REGEX.captures(input).context(InvalidFormatSnafu)?;

// SAFETY: We purposefully allow the `clippy::unwrap_in_result` lint here and below.
// We can use expect here, because the correct match labels must be used.
#[allow(clippy::unwrap_in_result)]
let identifier = captures
.name("identifier")
.expect("internal error: check that the correct match label is specified")
.as_str();

#[allow(clippy::unwrap_in_result)]
let version = captures
.name("version")
.expect("internal error: check that the correct match label is specified")
Expand Down
10 changes: 3 additions & 7 deletions crates/k8s-version/src/version/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,13 @@ pub struct Version {
impl FromStr for Version {
type Err = ParseVersionError;

// SAFETY: We purposefully allow the `clippy::unwrap_in_result` lint below in this function.
// We can use expect here, because the correct match label must be used.
//
// FIXME (@Techassi): This attribute can be used on individual unwrap and expect calls since
// Rust 1.91.0. We should move this attribute to not contaminate an unnecessarily large scope
// once we bump the toolchain to 1.91.0.
// See https://github.com/rust-lang/rust-clippy/pull/15445
#[allow(clippy::unwrap_in_result)]
fn from_str(input: &str) -> Result<Self, Self::Err> {
let captures = VERSION_REGEX.captures(input).context(InvalidFormatSnafu)?;

// SAFETY: We purposefully allow the `clippy::unwrap_in_result` lint below.
// We can use expect here, because the correct match label must be used.
#[allow(clippy::unwrap_in_result)]
let major = captures
.name("major")
.expect("internal error: check that the correct match label is specified")
Expand Down
14 changes: 4 additions & 10 deletions crates/stackable-certs/src/ca/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,16 +205,6 @@ where
/// validity, this function offers complete control over these parameters.
/// If this level of control is not needed, use [`CertificateAuthority::new`]
/// instead.
//
// SAFETY: We purposefully allow the `clippy::unwrap_in_result` lint below in this function.
// We can use expect here, because the subject name is defined as a constant which must be able
// to be parsed.
//
// FIXME (@Techassi): This attribute can be used on individual unwrap and expect calls since
// Rust 1.91.0. We should move this attribute to not contaminate an unnecessarily large scope
// once we bump the toolchain to 1.91.0.
// See https://github.com/rust-lang/rust-clippy/pull/15445
#[allow(clippy::unwrap_in_result)]
#[instrument(name = "create_certificate_authority_with", skip(signing_key_pair))]
pub fn new_with(signing_key_pair: S, serial_number: u64, validity: Duration) -> Result<Self> {
let serial_number = SerialNumber::from(serial_number);
Expand All @@ -223,6 +213,10 @@ where
// We don't allow customization of the CA subject by callers. Every CA
// created by us should contain the same subject consisting a common set
// of distinguished names (DNs).
// SAFETY: We purposefully allow the `clippy::unwrap_in_result` lint below.
// We can use expect here, because the subject name is defined as a constant which must be
// able to be parsed.
#[allow(clippy::unwrap_in_result)]
let subject = Name::from_str(SDP_ROOT_CA_SUBJECT)
.expect("the constant SDP_ROOT_CA_SUBJECT must be a valid subject");

Expand Down
Loading