Skip to content

Commit 4a06833

Browse files
committed
Fix broken docs
1 parent 1fdbae7 commit 4a06833

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/backends/googlepubsub/consumer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use super::{
2727
/// A PubSub subscription name.
2828
///
2929
/// This will be used to internally construct the expected
30-
/// `projects/{project}/subscriptions/hedwig-{queue}-{subscription}` format for API calls
30+
/// `projects/{project}/subscriptions/hedwig-{queue}-{subscription_name}` format for API calls
3131
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
3232
pub struct SubscriptionName<'s>(Cow<'s, str>);
3333

src/backends/googlepubsub/mod.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ macro_rules! match_fields {
4343
// nested cfg_attr prevents older compilers from parsing the new doc = EXPR syntax
4444
#[cfg_attr(docsrs, cfg_attr(docsrs,
4545
doc = "", // newline
46-
doc = concat!("This is a more ergonomic wrapper over [`", stringify!($target), "`]")
46+
doc = concat!("This is a more ergonomic wrapper over [`", match_fields!(@stringify_path $target), "`]")
4747
))]
4848
#[cfg_attr(not(docsrs), allow(missing_docs))]
4949
pub struct $struct_name $(<$struct_generics>)? {
5050
$(
5151
#[cfg_attr(docsrs, cfg_attr(docsrs, doc = concat!(
5252
"See [`", stringify!($field_name), "`]",
53-
"(", stringify!($target), "::", stringify!($field_name), ")"
53+
"(", match_fields!(@stringify_path $target::$field_name), ")"
5454
)))]
5555
$(#[$field_attr])*
5656
pub $field_name : $field_type,
@@ -72,7 +72,14 @@ macro_rules! match_fields {
7272
};
7373
};
7474
}
75-
}
75+
};
76+
77+
// directly calling `stringify!` on a path will put spaces inbetween the :: separators, which
78+
// then breaks doc linking.
79+
// For whatever reason (expansion order maybe?), a macro indirection makes the path space-less
80+
(@stringify_path $p:path) => {
81+
stringify!($p)
82+
};
7683
}
7784

7885
mod consumer;

src/backends/mock.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use std::{
1616
task::{Context, Poll},
1717
};
1818

19+
/// Errors originating from mock publisher and consumer operations
1920
#[derive(Debug, thiserror::Error)]
2021
#[error("{reason}")]
2122
pub struct Error {

0 commit comments

Comments
 (0)