Skip to content

Commit eb829cf

Browse files
committed
Improve failed scrape diagnostic
1 parent 818debb commit eb829cf

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/cargo/core/compiler/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ fn make_failed_scrape_diagnostic(
224224
"\
225225
{top_line}
226226
Try running with `--verbose` to see the error message.
227-
If an example or library should not be scanned, then consider adding `doc-scrape-examples = false` to its `[[example]]` or `[lib]` definition in {}",
227+
If an example should not be scanned, then consider adding `doc-scrape-examples = false` to its `[[example]]` definition in {}",
228228
relative_manifest_path.display()
229229
)
230230
}

src/cargo/ops/cargo_compile/unit_generator.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,8 +680,10 @@ impl<'a> UnitGenerator<'a, '_> {
680680

681681
/// Generates units specfically for doc-scraping.
682682
///
683-
/// This requires a separate entrypoint from `generate_root_units` because it
683+
/// This requires a separate entrypoint from [`generate_root_units`] because it
684684
/// takes the documented units as input.
685+
///
686+
/// [`generate_root_units`]: Self::generate_root_units
685687
pub fn generate_scrape_units(&self, doc_units: &[Unit]) -> CargoResult<Vec<Unit>> {
686688
let scrape_proposals = self.create_docscrape_proposals(&doc_units)?;
687689
let scrape_units = self.proposals_to_units(scrape_proposals)?;

tests/testsuite/docscrape.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,15 +350,15 @@ fn no_fail_bad_lib() {
350350
[SCRAPING] foo v0.0.1 ([CWD])
351351
warning: failed to check lib in package `foo` as a prerequisite for scraping examples from: example \"ex\", example \"ex2\"
352352
Try running with `--verbose` to see the error message.
353-
If an example or library should not be scanned, then consider adding `doc-scrape-examples = false` to its `[[example]]` or `[lib]` definition in Cargo.toml
353+
If an example should not be scanned, then consider adding `doc-scrape-examples = false` to its `[[example]]` definition in Cargo.toml
354354
warning: `foo` (lib) generated 1 warning
355355
warning: failed to scan example \"ex\" in package `foo` for example code usage
356356
Try running with `--verbose` to see the error message.
357-
If an example or library should not be scanned, then consider adding `doc-scrape-examples = false` to its `[[example]]` or `[lib]` definition in Cargo.toml
357+
If an example should not be scanned, then consider adding `doc-scrape-examples = false` to its `[[example]]` definition in Cargo.toml
358358
warning: `foo` (example \"ex\") generated 1 warning
359359
warning: failed to scan example \"ex2\" in package `foo` for example code usage
360360
Try running with `--verbose` to see the error message.
361-
If an example or library should not be scanned, then consider adding `doc-scrape-examples = false` to its `[[example]]` or `[lib]` definition in Cargo.toml
361+
If an example should not be scanned, then consider adding `doc-scrape-examples = false` to its `[[example]]` definition in Cargo.toml
362362
warning: `foo` (example \"ex2\") generated 1 warning
363363
[DOCUMENTING] foo v0.0.1 ([CWD])
364364
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]",
@@ -391,7 +391,7 @@ fn no_fail_bad_example() {
391391
[SCRAPING] foo v0.0.1 ([CWD])
392392
warning: failed to scan example \"ex1\" in package `foo` for example code usage
393393
Try running with `--verbose` to see the error message.
394-
If an example or library should not be scanned, then consider adding `doc-scrape-examples = false` to its `[[example]]` or `[lib]` definition in Cargo.toml
394+
If an example should not be scanned, then consider adding `doc-scrape-examples = false` to its `[[example]]` definition in Cargo.toml
395395
warning: `foo` (example \"ex1\") generated 1 warning
396396
[DOCUMENTING] foo v0.0.1 ([CWD])
397397
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]",

0 commit comments

Comments
 (0)