Commit 00cc4457 authored by Nick Mathewson's avatar Nick Mathewson 🤹
Browse files

Merge branch 'msrv-20260504' into 'main'

Resolve various MSRV todos.

See merge request !3943
parents 22237bed 9bb9c1eb
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
BREAKING: Removed flatten().
+1 −16
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ pub fn iter_join(
    separator: &str,
    iter: impl Iterator<Item: fmt::Display> + Clone,
) -> impl fmt::Display {
    // TODO: This can be replaced with `std::fmt::from_fn()` once stabilised and within our MSRV.
    // TODO MSRV 1.93: Replace with `std::fmt::from_fn()`?
    struct Fmt<'a, I: Iterator<Item: fmt::Display> + Clone> {
        /// Separates items in `iter`.
        separator: &'a str,
@@ -578,21 +578,6 @@ macro_rules! derive_serde_raw { {

// ----------------------------------------------------------------------

/// Flatten a `Result<Result<T, E>, E>` into a `Result<T, E>`.
///
/// See [`Result::flatten`], which is not available
/// at our current MSRV.
// TODO MSRV 1.89: When our MSRV is at least 1.89,
// remove this function and replace uses with `Result::flatten`.
pub fn flatten<T, E>(x: Result<Result<T, E>, E>) -> Result<T, E> {
    match x {
        Ok(Ok(x)) => Ok(x),
        Err(e) | Ok(Err(e)) => Err(e),
    }
}

// ----------------------------------------------------------------------

/// Asserts that the type of the expression implements the given trait.
///
/// Example:
+4 −7
Original line number Diff line number Diff line
@@ -2506,17 +2506,15 @@ mod test {
        #[derive(Deftly, Clone, Debug, PartialEq)]
        #[derive_deftly(TorConfig)]
        pub(super) struct CfgEnabled {
            // MSRV 1.88: Use "true" instead.
            #[deftly(tor_config(
                default,
                cfg = "all()",
                cfg = "true",
                cfg_desc = "with eschaton immenentization"
            ))]
            pub(super) flower_power: u32,
            // MSRV 1.88: Use "true" instead.
            #[deftly(tor_config(
                default,
                cfg = "all()",
                cfg = "true",
                cfg_reject,
                cfg_desc = "with eschaton immenentization"
            ))]
@@ -2526,16 +2524,15 @@ mod test {
        #[derive(Deftly, Clone, Debug, PartialEq)]
        #[derive_deftly(TorConfig)]
        pub(super) struct CfgDisabled {
            // MSRV 1.88: Use "false" instead.
            #[deftly(tor_config(
                default,
                cfg = "any()",
                cfg = "false",
                cfg_desc = "with resublimated thiotimoline"
            ))]
            pub(super) time_travel: u32,
            #[deftly(tor_config(
                default,
                cfg = "any()",
                cfg = "false",
                cfg_reject,
                cfg_desc = "with resublimated thiotimoline"
            ))]
+2 −2
Original line number Diff line number Diff line
@@ -16,9 +16,9 @@ pub mod restricted_discovery;

// Only exported with pub visibility if the restricted-discovery feature is enabled.
#[cfg(not(feature = "restricted-discovery"))]
// Use cfg(all()) to prevent this from being documented as
// Use cfg(true) to prevent this from being documented as
// "Available on non-crate feature `restricted-discovery` only"
#[cfg_attr(docsrs, doc(cfg(all())))]
#[cfg_attr(docsrs, doc(cfg(true)))]
pub(crate) mod restricted_discovery;

/// Configuration for one onion service.
+2 −2
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
///
/// These ciphers implement the `cipher::StreamCipher` trait, so use
/// the [`cipher`](https://docs.rs/cipher) crate to access them.
#[cfg_attr(docsrs, doc(cfg(all())))]
#[cfg_attr(docsrs, doc(cfg(true)))]
#[cfg(not(feature = "with-openssl"))]
pub mod aes {
    // These implement StreamCipher.
@@ -22,7 +22,7 @@ pub mod aes {
///
/// These ciphers implement the `cipher::StreamCipher` trait, so use
/// the [`cipher`](https://docs.rs/cipher) crate to access them.
#[cfg_attr(docsrs, doc(cfg(all())))]
#[cfg_attr(docsrs, doc(cfg(true)))]
#[cfg(feature = "with-openssl")]
pub mod aes {
    use cipher::generic_array::GenericArray;
Loading