]> git.lizzy.rs Git - rust.git/commitdiff
Address nits in DOC_MARKDOWN
authormcarton <cartonmartin+git@gmail.com>
Mon, 28 Mar 2016 19:23:21 +0000 (21:23 +0200)
committermcarton <cartonmartin+git@gmail.com>
Mon, 28 Mar 2016 19:24:52 +0000 (21:24 +0200)
README.md
src/bit_mask.rs
src/doc.rs
tests/compile-fail/doc.rs

index 264bc6f010bbc1fe348cd7a5cbefb2c56c7bc678..43caa80543a860be41b7407951d0ede9e19cb210 100644 (file)
--- a/README.md
+++ b/README.md
@@ -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
 ---------------------------------------------------------------------------------------------------------------------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
index 15fbabf9f0b396ee7fc6b291eb3fcf60deaab860..28fc311507d9a424c5a7f9060c6b6929476d068c 100644 (file)
 /// 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).
 ///
 /// 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` |
 ///
index a4a0448c102e7a660e7486d5e04560268463be11..5637fb2cefb6991565902eca2cf9dbe61ce88a34 100644 (file)
@@ -8,7 +8,8 @@
 /// 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 is_camel_case(s: &str) -> bool {
             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
     }
index 35b5857d93725460c3e41e6447f6da800860ef35..eecf5e0b20620db3e6adf2c58f5a8659b8980a35 100755 (executable)
@@ -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();
 }