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, /// it. However, it works pretty well in practice. In particular,
/// this is needed to deal with projection outlives bounds like /// 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 /// <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 /// ```rust
/// ``` /// ```
/// ///
/// Unclosed code blocks (with and without the `rust` marker): /// Invalid syntax in code blocks:
/// ///
/// ```rust /// ```rust
fn main() {} /// '<
/// ```
pub fn foo() {}
``` ```
Which will give: Which will give:
```text ```text
warning: Rust code block is empty warning: Rust code block is empty
--> src/lib.rs:3:5 --> lint.rs:3:5
| |
3 | /// ```rust 3 | /// ```rust
| _____^ | _____^
4 | | /// ``` 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 warning: could not parse code block as Rust code
--> src/lib.rs:8:5 --> lint.rs:8:5
| |
8 | /// ```rust 8 | /// ```rust
| ^^^^^^^ | _____^
9 | | /// '<
10 | | /// ```
| |_______^
|
= note: error from rustc: unterminated character literal
``` ```
## bare_urls ## bare_urls

View File

@ -48,7 +48,7 @@ impl<'a, 'tcx> SyntaxChecker<'a, 'tcx> {
.unwrap_or(false); .unwrap_or(false);
let buffer = buffer.borrow(); let buffer = buffer.borrow();
if !(buffer.has_errors || is_empty) { if !buffer.has_errors && !is_empty {
// No errors in a non-empty program. // No errors in a non-empty program.
return; return;
} }