Address nits in DOC_MARKDOWN
This commit is contained in:
parent
b1d1f095f1
commit
371a5537eb
@ -14,7 +14,7 @@ Table of contents:
|
||||
* [License](#license)
|
||||
|
||||
##Lints
|
||||
There are 136 lints included in this crate:
|
||||
There are 137 lints included in this crate:
|
||||
|
||||
name | default | meaning
|
||||
---------------------------------------------------------------------------------------------------------------------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -13,14 +13,14 @@ use utils::span_lint;
|
||||
/// The formula for detecting if an expression of the type `_ <bit_op> m <cmp_op> c` (where `<bit_op>`
|
||||
/// is one of {`&`, `|`} and `<cmp_op>` is one of {`!=`, `>=`, `>`, `!=`, `>=`, `>`}) can be determined from the following table:
|
||||
///
|
||||
/// |Comparison |Bit Op |Example |is always|Formula |
|
||||
/// |------------|-------|------------|---------|----------------------|
|
||||
/// |`==` or `!=`| `&` |`x & 2 == 3`|`false` |`c & m != c` |
|
||||
/// |`<` or `>=`| `&` |`x & 2 < 3` |`true` |`m < c` |
|
||||
/// |`>` or `<=`| `&` |`x & 1 > 1` |`false` |`m <= c` |
|
||||
/// |`==` or `!=`| `|` |`x | 1 == 0`|`false` |`c | m != c` |
|
||||
/// |`<` or `>=`| `|` |`x | 1 < 1` |`false` |`m >= c` |
|
||||
/// |`<=` or `>` | `|` |`x | 1 > 0` |`true` |`m > c` |
|
||||
/// |Comparison |Bit Op|Example |is always|Formula |
|
||||
/// |------------|------|------------|---------|----------------------|
|
||||
/// |`==` or `!=`| `&` |`x & 2 == 3`|`false` |`c & m != c` |
|
||||
/// |`<` or `>=`| `&` |`x & 2 < 3` |`true` |`m < c` |
|
||||
/// |`>` or `<=`| `&` |`x & 1 > 1` |`false` |`m <= c` |
|
||||
/// |`==` or `!=`| `|` |`x | 1 == 0`|`false` |`c | m != c` |
|
||||
/// |`<` or `>=`| `|` |`x | 1 < 1` |`false` |`m >= c` |
|
||||
/// |`<=` or `>` | `|` |`x | 1 > 0` |`true` |`m > c` |
|
||||
///
|
||||
/// **Why is this bad?** If the bits that the comparison cares about are always set to zero or one by the bit mask, the comparison is constant `true` or `false` (depending on mask, compared value, and operators).
|
||||
///
|
||||
@ -61,21 +61,21 @@ declare_lint! {
|
||||
/// is one of {`&`, '|'} and `<cmp_op>` is one of {`!=`, `>=`, `>` ,
|
||||
/// `!=`, `>=`, `>`}) can be determined from the following table:
|
||||
///
|
||||
/// |Comparison |Bit Op |Example |is always|Formula |
|
||||
/// |------------|-------|------------|---------|----------------------|
|
||||
/// |`==` or `!=`| `&` |`x & 2 == 3`|`false` |`c & m != c` |
|
||||
/// |`<` or `>=`| `&` |`x & 2 < 3` |`true` |`m < c` |
|
||||
/// |`>` or `<=`| `&` |`x & 1 > 1` |`false` |`m <= c` |
|
||||
/// |`==` or `!=`| `|` |`x | 1 == 0`|`false` |`c | m != c` |
|
||||
/// |`<` or `>=`| `|` |`x | 1 < 1` |`false` |`m >= c` |
|
||||
/// |`<=` or `>` | `|` |`x | 1 > 0` |`true` |`m > c` |
|
||||
/// |Comparison |Bit Op|Example |is always|Formula |
|
||||
/// |------------|------|------------|---------|----------------------|
|
||||
/// |`==` or `!=`| `&` |`x & 2 == 3`|`false` |`c & m != c` |
|
||||
/// |`<` or `>=`| `&` |`x & 2 < 3` |`true` |`m < c` |
|
||||
/// |`>` or `<=`| `&` |`x & 1 > 1` |`false` |`m <= c` |
|
||||
/// |`==` or `!=`| `|` |`x | 1 == 0`|`false` |`c | m != c` |
|
||||
/// |`<` or `>=`| `|` |`x | 1 < 1` |`false` |`m >= c` |
|
||||
/// |`<=` or `>` | `|` |`x | 1 > 0` |`true` |`m > c` |
|
||||
///
|
||||
/// This lint is **deny** by default
|
||||
///
|
||||
/// There is also a lint that warns on ineffective masks that is *warn*
|
||||
/// by default.
|
||||
///
|
||||
/// |Comparison| Bit Op |Example |equals |Formula|
|
||||
/// |Comparison|Bit Op |Example |equals |Formula|
|
||||
/// |`>` / `<=`|`|` / `^`|`x | 2 > 3`|`x > 3`|`¹ && m <= c`|
|
||||
/// |`<` / `>=`|`|` / `^`|`x ^ 1 < 4`|`x < 4`|`¹ && m < c` |
|
||||
///
|
||||
|
@ -8,7 +8,8 @@ use utils::span_lint;
|
||||
/// ticks in documentation.
|
||||
///
|
||||
/// **Why is this bad?** *Rustdoc* supports markdown formatting, `_`, `::` and camel-case probably
|
||||
/// indicates some code which should be included between ticks.
|
||||
/// indicates some code which should be included between ticks. `_` can also be used for empasis in
|
||||
/// markdown, this lint tries to consider that.
|
||||
///
|
||||
/// **Known problems:** Lots of bad docs won’t be fixed, what the lint checks for is limited.
|
||||
///
|
||||
@ -114,6 +115,7 @@ fn check_word(cx: &EarlyContext, word: &str, span: Span) {
|
||||
s
|
||||
};
|
||||
|
||||
s.chars().all(char::is_alphanumeric) &&
|
||||
s.chars().filter(|&c| c.is_uppercase()).take(2).count() > 1 &&
|
||||
s.chars().filter(|&c| c.is_lowercase()).take(1).count() > 0
|
||||
}
|
||||
|
@ -18,13 +18,21 @@ fn foo_bar() {
|
||||
/// That one tests multiline ticks.
|
||||
/// ```rust
|
||||
/// foo_bar FOO_BAR
|
||||
/// _foo bar_
|
||||
/// ```
|
||||
fn multiline_ticks() {
|
||||
}
|
||||
|
||||
/// This _is a test for
|
||||
/// multiline
|
||||
/// emphasis_.
|
||||
fn test_emphasis() {
|
||||
}
|
||||
|
||||
/// The `main` function is the entry point of the program. Here it only calls the `foo_bar` and
|
||||
/// `multiline_ticks` functions.
|
||||
fn main() {
|
||||
foo_bar();
|
||||
multiline_ticks();
|
||||
test_emphasis();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user