mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 08:30:45 +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,13 +9,22 @@ use utils::{paths, method_chain_args, span_help_and_lint, match_type, snippet};
|
|||
/// **Known problems:** None.
|
||||
///
|
||||
/// **Example:**
|
||||
/// ```rustc
|
||||
/// ```rust
|
||||
/// for result in iter {
|
||||
/// if let Some(bench) = try!(result).parse().ok() {
|
||||
/// vec.push(bench)
|
||||
/// }
|
||||
/// }
|
||||
///```
|
||||
/// Could be written:
|
||||
///
|
||||
/// ```rust
|
||||
/// for result in iter {
|
||||
/// if let Ok(bench) = try!(result).parse() {
|
||||
/// vec.push(bench)
|
||||
/// }
|
||||
/// }
|
||||
/// ```
|
||||
declare_lint! {
|
||||
pub IF_LET_SOME_RESULT,
|
||||
Warn,
|
||||
|
|
Loading…
Reference in a new issue