I'm writing some rust doc examples (that are compiling):
/// ```rust
/// # #[macro_use]
/// # extern crate ...
/// ...
/// ```
But cargo doc
gives me this [incorrect] warning:
warning: could not parse code block as Rust code
--> srml/support/src/dispatch.rs:105:5
|
105 | /// ```rust
| ________^
106 | | /// # #[macro_use]
| |_
|
= note: error from rustc: unknown start of token: `
help: mark blocks that do not contain Rust code as text
|
105 | /// ```textrust
| ^^^^^^^
Should I just suppress this warning.. or is something off here?
You fix the error by using valid Rust code inside the code block.
This reproduces the problem:
Don't add spurious whitespace before your code blocks. In Markdown, four spaces counts as the beginning of code, so you have actually done the equivalent of the HTML:
As it tells you,
```
isn't valid Rust code.