Use better syntax for doc comment attribute

As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/471#note_2798020
This commit is contained in:
Ian Jackson 2022-04-25 16:49:42 +01:00
parent 24518675db
commit dca4f3ede1
5 changed files with 11 additions and 23 deletions

View File

@ -66,9 +66,7 @@ impl LoggingConfig {
type LogfileListConfig = Vec<LogfileConfig>;
define_list_config_builder! {
[
/// List of logfiles to use, being built as part of the configuration
]
pub struct LogfileListConfigBuilder {
files: [LogfileConfigBuilder],
}

View File

@ -186,9 +186,7 @@ fn default_preemptive_threshold() -> usize {
type PredictedPortsList = Vec<u16>;
define_list_config_builder! {
[
/// List of preemptive ports, being built as part of the configuration
]
pub struct PredictedPortsListBuilder {
pub(crate) ports: [u16],
}

View File

@ -35,9 +35,7 @@
/// pub struct ThingList { things: Vec<Thing> }
///
/// define_list_config_builder! {
/// [
/// /// List of things, being built as part of the configuration
/// ]
/// pub struct ThingListBuilder {
/// pub(crate) things: [ThingBuilder],
/// }
@ -55,9 +53,7 @@
#[macro_export]
macro_rules! define_list_config_builder {
{
[
$($docs_and_attrs:tt)*
]
$(#[ $docs_and_attrs:meta ])*
pub struct $ListBuilder:ident {
$field_vis:vis $things:ident : [$EntryBuilder:ty] $(,)?
}
@ -65,7 +61,7 @@ macro_rules! define_list_config_builder {
default = $default:expr;
$( item_build: $item_build:expr; )?
} => {
$($docs_and_attrs)*
$(#[ $docs_and_attrs ])*
#[derive(Default, Clone, Deserialize)]
#[serde(transparent)]
///

View File

@ -45,9 +45,7 @@ impl Authority {
pub(crate) type AuthorityList = Vec<Authority>;
define_list_config_builder! {
[
/// List of authorities, being built as part of the configuration
]
pub struct AuthorityListBuilder {
authorities: [AuthorityBuilder],
}

View File

@ -31,13 +31,11 @@ impl<T: IntoIterator<Item = FallbackDir>> From<T> for FallbackList {
}
define_list_config_builder! {
[
/// List of fallback directories, being built as part of the configuration
///
/// Fallback directories (represented by [`FallbackDir`]) are used by Tor
/// clients when they don't already have enough other directory information to
/// contact the network.
]
pub struct FallbackListBuilder {
pub(crate) fallbacks: [FallbackDirBuilder],
}