mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-26 22:50:56 +00:00
Merge pull request #1311 from gibfahn/if_let_some_result
Add to docs for if_let_some_result
This commit is contained in:
commit
0e1f065678
1 changed files with 10 additions and 1 deletions
|
@ -9,12 +9,21 @@ use utils::{paths, method_chain_args, span_help_and_lint, match_type, snippet};
|
||||||
/// **Known problems:** None.
|
/// **Known problems:** None.
|
||||||
///
|
///
|
||||||
/// **Example:**
|
/// **Example:**
|
||||||
/// ```rustc
|
/// ```rust
|
||||||
/// for result in iter {
|
/// for result in iter {
|
||||||
/// if let Some(bench) = try!(result).parse().ok() {
|
/// if let Some(bench) = try!(result).parse().ok() {
|
||||||
/// vec.push(bench)
|
/// vec.push(bench)
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
|
///```
|
||||||
|
/// Could be written:
|
||||||
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// for result in iter {
|
||||||
|
/// if let Ok(bench) = try!(result).parse() {
|
||||||
|
/// vec.push(bench)
|
||||||
|
/// }
|
||||||
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
declare_lint! {
|
declare_lint! {
|
||||||
pub IF_LET_SOME_RESULT,
|
pub IF_LET_SOME_RESULT,
|
||||||
|
|
Loading…
Reference in a new issue