mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 17:33:07 +00:00
s/``/
``rust when relevant
It looks better on the wiki/the new documentation page.
This commit is contained in:
parent
0fbb0bf77b
commit
81b9b2ca85
@ -41,7 +41,7 @@ contains some questionable code itself! Also before making a pull request, pleas
|
|||||||
travis build actually checks for this.
|
travis build actually checks for this.
|
||||||
|
|
||||||
Also please document your lint with a doc comment akin to the following:
|
Also please document your lint with a doc comment akin to the following:
|
||||||
```
|
```rust
|
||||||
/// **What it does:** Describe what the lint matches.
|
/// **What it does:** Describe what the lint matches.
|
||||||
///
|
///
|
||||||
/// **Why is this bad?** Write the reason for linting the code.
|
/// **Why is this bad?** Write the reason for linting the code.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//!
|
//!
|
||||||
//! For example, the lint would catch:
|
//! For example, the lint would catch:
|
||||||
//!
|
//!
|
||||||
//! ```
|
//! ```rust
|
||||||
//! if x {
|
//! if x {
|
||||||
//! if y {
|
//! if y {
|
||||||
//! println!("Hello world");
|
//! println!("Hello world");
|
||||||
|
@ -11,7 +11,7 @@ use utils::{get_item_name, match_type, paths, snippet, span_lint_and_then, walk_
|
|||||||
/// **Why is this bad?** Using `entry` is more efficient.
|
/// **Why is this bad?** Using `entry` is more efficient.
|
||||||
///
|
///
|
||||||
/// **Known problems:** Some false negatives, eg.:
|
/// **Known problems:** Some false negatives, eg.:
|
||||||
/// ```
|
/// ```rust
|
||||||
/// let k = &key;
|
/// let k = &key;
|
||||||
/// if !m.contains_key(k) { m.insert(k.clone(), v); }
|
/// if !m.contains_key(k) { m.insert(k.clone(), v); }
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -65,7 +65,7 @@ impl LateLintPass for Pass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Checks if the expressions matches
|
/// Checks if the expressions matches
|
||||||
/// ```
|
/// ```rust
|
||||||
/// { static __STATIC_FMTSTR: &[""] = _; __STATIC_FMTSTR }
|
/// { static __STATIC_FMTSTR: &[""] = _; __STATIC_FMTSTR }
|
||||||
/// ```
|
/// ```
|
||||||
fn check_static_str(cx: &LateContext, expr: &Expr) -> bool {
|
fn check_static_str(cx: &LateContext, expr: &Expr) -> bool {
|
||||||
@ -91,7 +91,7 @@ fn check_static_str(cx: &LateContext, expr: &Expr) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Checks if the expressions matches
|
/// Checks if the expressions matches
|
||||||
/// ```
|
/// ```rust
|
||||||
/// &match (&42,) {
|
/// &match (&42,) {
|
||||||
/// (__arg0,) => [::std::fmt::ArgumentV1::new(__arg0, ::std::fmt::Display::fmt)],
|
/// (__arg0,) => [::std::fmt::ArgumentV1::new(__arg0, ::std::fmt::Display::fmt)],
|
||||||
/// })
|
/// })
|
||||||
|
@ -357,7 +357,7 @@ impl LateLintPass for ModuloOne {
|
|||||||
/// **Known problems:** None
|
/// **Known problems:** None
|
||||||
///
|
///
|
||||||
/// **Example**:
|
/// **Example**:
|
||||||
/// ```
|
/// ```rust
|
||||||
/// match v {
|
/// match v {
|
||||||
/// Some(x) => (),
|
/// Some(x) => (),
|
||||||
/// y @ _ => (), // easier written as `y`,
|
/// y @ _ => (), // easier written as `y`,
|
||||||
@ -399,7 +399,7 @@ impl LateLintPass for PatternPass {
|
|||||||
/// allowed in the mean time.
|
/// allowed in the mean time.
|
||||||
///
|
///
|
||||||
/// **Example**:
|
/// **Example**:
|
||||||
/// ```
|
/// ```rust
|
||||||
/// let _x = 0;
|
/// let _x = 0;
|
||||||
/// let y = _x + 1; // Here we are using `_x`, even though it has a leading underscore.
|
/// let y = _x + 1; // Here we are using `_x`, even though it has a leading underscore.
|
||||||
/// // We should rename `_x` to `x`
|
/// // We should rename `_x` to `x`
|
||||||
|
Loading…
Reference in New Issue
Block a user