Skip to content

Commit 08463b0

Browse files
committed
Fix private intradoc links
- setup CI to check private intradoc links - make `cargo.doc` Makefile command to generate private item docs by default
1 parent b82659e commit 08463b0

File tree

8 files changed

+32
-16
lines changed

8 files changed

+32
-16
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
profile: minimal
116116
toolchain: stable
117117

118-
- run: make cargo.doc open=no
118+
- run: make cargo.doc private=yes open=no
119119

120120

121121

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,16 @@ test: test.cargo test.book
3939
# Generate crates documentation from Rust sources.
4040
#
4141
# Usage:
42-
# make cargo.doc [crate=<crate-name>] [open=(yes|no)] [clean=(no|yes)]
42+
# make cargo.doc [crate=<crate-name>] [private=(yes|no)]
43+
# [open=(yes|no)] [clean=(no|yes)]
4344

4445
cargo.doc:
4546
ifeq ($(clean),yes)
4647
@rm -rf target/doc/
4748
endif
4849
cargo +stable doc $(if $(call eq,$(crate),),--workspace,-p $(crate)) \
4950
--all-features \
51+
$(if $(call eq,$(private),no),,--document-private-items) \
5052
$(if $(call eq,$(open),no),,--open)
5153

5254

codegen/src/attribute.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ impl Step {
212212
})
213213
}
214214

215-
/// Composes name of the [`WorldInventory`] method to wire this [`Step`]
216-
/// with.
215+
/// Composes a name of the `cucumber::codegen::WorldInventory` method to
216+
/// wire this [`Step`] with.
217217
fn constructor_method(&self) -> syn::Ident {
218218
format_ident!("new_{}", self.attr_name)
219219
}
@@ -224,6 +224,7 @@ impl Step {
224224
/// Function's argument type have to implement [`FromStr`].
225225
///
226226
/// [`FromStr`]: std::str::FromStr
227+
/// [`syn::Ident`]: struct@syn::Ident
227228
fn arg_ident_and_parse_code<'a>(
228229
&self,
229230
arg: &'a syn::FnArg,
@@ -302,7 +303,9 @@ enum AttributeArgument {
302303
}
303304

304305
impl AttributeArgument {
305-
/// Returns [`syn::LitStr`] to construct a [`Regex`] with.
306+
/// Returns a [`syn::LitStr`] to construct a [`Regex`] with.
307+
///
308+
/// [`syn::LitStr`]: struct@syn::LitStr
306309
fn regex_literal(&self) -> syn::LitStr {
307310
match self {
308311
Self::Regex(l) => l.clone(),
@@ -431,6 +434,8 @@ fn remove_attr(attr_arg: &str, arg: &mut syn::FnArg) -> Option<syn::Attribute> {
431434
}
432435

433436
/// Parses [`syn::Ident`] and [`syn::Type`] from the given [`syn::FnArg`].
437+
///
438+
/// [`syn::Ident`]: struct@syn::Ident
434439
fn parse_fn_arg(arg: &syn::FnArg) -> syn::Result<(&syn::Ident, &syn::Type)> {
435440
let arg = match arg {
436441
syn::FnArg::Typed(t) => t,
@@ -476,7 +481,7 @@ fn find_first_slice(sig: &syn::Signature) -> Option<&syn::TypePath> {
476481
})
477482
}
478483

479-
/// Parses [`cucumber::World`] from arguments of the function signature.
484+
/// Parses `cucumber::World` from arguments of the function signature.
480485
fn parse_world_from_args(sig: &syn::Signature) -> syn::Result<&syn::TypePath> {
481486
sig.inputs
482487
.first()
@@ -506,6 +511,9 @@ fn parse_world_from_args(sig: &syn::Signature) -> syn::Result<&syn::TypePath> {
506511
}
507512

508513
/// Converts [`syn::Lit`] to [`syn::LitStr`] if possible.
514+
///
515+
/// [`syn::Lit`]: enum@syn::Lit
516+
/// [`syn::LitStr`]: struct@syn::LitStr
509517
fn to_string_literal(l: syn::Lit) -> syn::Result<syn::LitStr> {
510518
match l {
511519
syn::Lit::Str(str) => Ok(str),

codegen/src/derive.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ pub(crate) fn world_init(
3636
}
3737

3838
/// Generates [`syn::Ident`]s of generic types for private trait impl.
39+
///
40+
/// [`syn::Ident`]: struct@syn::Ident
3941
fn step_types(steps: &[&str]) -> Vec<syn::Ident> {
4042
steps
4143
.iter()

src/feature.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ impl Ext for gherkin::Feature {
115115
///
116116
/// See [`ExpandExamplesError`] for details.
117117
///
118-
/// [`Examples`]: gherkin::Example
118+
/// [`Examples`]: gherkin::Examples
119119
/// [`Scenario`]: gherkin::Scenario
120120
fn expand_scenario(
121121
scenario: gherkin::Scenario,

src/runner/basic.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,8 @@ struct Features {
10871087
scenarios: Arc<Mutex<Scenarios>>,
10881088

10891089
/// Indicates whether all parsed [`Feature`]s are sorted and stored.
1090+
///
1091+
/// [`Feature`]: gherkin::Feature
10901092
finished: Arc<AtomicBool>,
10911093
}
10921094

src/step.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ pub struct Context {
169169
pub matches: Vec<String>,
170170
}
171171

172-
/// [`Regex`] wrapper to store inside a [`LinkedHashMap`].
172+
/// [`Regex`] wrapper to store it as a key of a [`HashMap`].
173173
#[derive(Clone, Debug)]
174174
struct HashableRegex(Regex);
175175

src/writer/basic.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,14 @@ impl Basic {
117117
}
118118
}
119119

120-
/// Outputs [error] encountered while parsing some [`Feature`].
120+
/// Outputs the parsing `error` encountered while parsing some [`Feature`].
121121
///
122-
/// [error]: event::Cucumber::ParsingError
123122
/// [`Feature`]: gherkin::Feature
124-
fn parsing_failed(&self, err: impl Display) {
125-
self.write_line(&self.styles.err(format!("Failed to parse: {}", err)))
126-
.unwrap();
123+
fn parsing_failed(&self, error: impl Display) {
124+
self.write_line(
125+
&self.styles.err(format!("Failed to parse: {}", error)),
126+
)
127+
.unwrap();
127128
}
128129

129130
/// Outputs [started] [`Feature`] to STDOUT.
@@ -145,6 +146,7 @@ impl Basic {
145146
/// [finished]: event::Rule::Finished
146147
/// [scenario]: event::Rule::Scenario
147148
/// [started]: event::Rule::Started
149+
/// [`Rule`]: gherkin::Rule
148150
fn rule<W: Debug>(
149151
&mut self,
150152
feat: &gherkin::Feature,
@@ -184,7 +186,7 @@ impl Basic {
184186

185187
/// Outputs [`Scenario`] [started]/[background]/[step] event to STDOUT.
186188
///
187-
/// [background]: event::Background
189+
/// [background]: event::Scenario::Background
188190
/// [started]: event::Scenario::Started
189191
/// [step]: event::Step
190192
/// [`Scenario`]: gherkin::Scenario
@@ -306,7 +308,7 @@ impl Basic {
306308
/// This [`Step`] is printed only if terminal is present and gets
307309
/// overwritten by later [passed]/[skipped]/[failed] events.
308310
///
309-
/// [started]: event::Step::Started
311+
/// [failed]: event::Step::Failed
310312
/// [passed]: event::Step::Passed
311313
/// [skipped]: event::Step::Skipped
312314
/// [started]: event::Step::Started
@@ -489,7 +491,7 @@ impl Basic {
489491
/// This [`Step`] is printed only if terminal is present and gets
490492
/// overwritten by later [passed]/[skipped]/[failed] events.
491493
///
492-
/// [started]: event::Step::Started
494+
/// [failed]: event::Step::Failed
493495
/// [passed]: event::Step::Passed
494496
/// [skipped]: event::Step::Skipped
495497
/// [started]: event::Step::Started

0 commit comments

Comments
 (0)