Commit 86647662 authored by Ian Jackson's avatar Ian Jackson
Browse files

Rename macro_first_nonempty (from macro_coalesce_args)

parent 1f215da1
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -162,10 +162,10 @@ macro_rules! define_accessor_trait {
/// `macro_coalesce_args` takes each of its possible expansions in `[ ]` and returns
/// `macro_coalesce_args` takes each of its possible expansions in `[ ]` and returns
/// the first nonempty one.
/// the first nonempty one.
#[macro_export]
#[macro_export]
macro_rules! macro_coalesce_args {
macro_rules! macro_first_nonempty {
    { [ $($yes:tt)+ ] $($rhs:tt)* } => { $($yes)* };
    { [ $($yes:tt)+ ] $($rhs:tt)* } => { $($yes)* };
    { [ ]$(,)? [ $($otherwise:tt)* ] $($rhs:tt)* } => {
    { [ ]$(,)? [ $($otherwise:tt)* ] $($rhs:tt)* } => {
        $crate::macro_coalesce_args!{ [ $($otherwise)* ] $($rhs)* }
        $crate::macro_first_nonempty!{ [ $($otherwise)* ] $($rhs)* }
    };
    };
}
}


+1 −1
Original line number Original line Diff line number Diff line
@@ -55,7 +55,7 @@ pub use err::{ConfigBuildError, ReconfigureError};
pub use mut_cfg::MutCfg;
pub use mut_cfg::MutCfg;
pub use path::CfgPath;
pub use path::CfgPath;


pub use tor_basic_utils::macro_coalesce_args;
pub use tor_basic_utils::macro_first_nonempty;


/// Rules for reconfiguring a running Arti instance.
/// Rules for reconfiguring a running Arti instance.
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
+1 −1
Original line number Original line Diff line number Diff line
@@ -105,7 +105,7 @@ macro_rules! define_list_config_builder {
                let $things = $things
                let $things = $things
                    .iter()
                    .iter()
                    .map(
                    .map(
                        $crate::macro_coalesce_args!{
                        $crate::macro_first_nonempty!{
                            [ $( $item_build )? ],
                            [ $( $item_build )? ],
                            [ |item| item.build() ],
                            [ |item| item.build() ],
                        }
                        }