Address review comments

- Simplify boolean expression
- Give an example of invalid syntax
- Remove explanation of why code block is text
This commit is contained in:
Joshua Nelson 2021-05-03 22:19:49 -04:00
parent b885d81a4a
commit 18f6922d8c
3 changed files with 22 additions and 15 deletions

View file

@ -1241,7 +1241,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
/// 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
/// ```
///

View file

@ -305,30 +305,37 @@ examples that are invalid (e.g. empty, not parsable as Rust). For example:
/// ```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

View file

@ -48,7 +48,7 @@ impl<'a, 'tcx> SyntaxChecker<'a, 'tcx> {
.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;
}