- Simplify boolean expression
- Give an example of invalid syntax
- Remove explanation of why code block is text
/// it. However, it works pretty well in practice. In particular,
/// this is needed to deal with projection outlives bounds like
///
- /// ```text (internal compiler representation so lifetime syntax is invalid)
+ /// ```text
/// <T as Foo<'0>>::Item: '1
/// ```
///
/// ```rust
/// ```
///
-/// Unclosed code blocks (with and without the `rust` marker):
+/// Invalid syntax in code blocks:
///
/// ```rust
-fn main() {}
+/// '<
+/// ```
+pub fn foo() {}
```
Which will give:
```text
warning: Rust code block is empty
---> src/lib.rs:3:5
-|
+ --> lint.rs:3:5
+ |
3 | /// ```rust
-| _____^
+ | _____^
4 | | /// ```
-| |_______^
-|
-= note: `#[warn(rustdoc::invalid_rust_codeblocks)]` on by default
+ | |_______^
+ |
+ = note: `#[warn(rustdoc::invalid_rust_codeblocks)]` on by default
-warning: Rust code block is empty
---> src/lib.rs:8:5
-|
-8 | /// ```rust
-| ^^^^^^^
+warning: could not parse code block as Rust code
+ --> lint.rs:8:5
+ |
+8 | /// ```rust
+ | _____^
+9 | | /// '<
+10 | | /// ```
+ | |_______^
+ |
+ = note: error from rustc: unterminated character literal
```
## bare_urls
.unwrap_or(false);
let buffer = buffer.borrow();
- if !(buffer.has_errors || is_empty) {
+ if !buffer.has_errors && !is_empty {
// No errors in a non-empty program.
return;
}