Make suggested changes

- Fix copy-paste error
- Check for opt.map_or argument after ensuring that opt is an Option
- Use span_lint_and_then and span_suggestion
- Update reference
This commit is contained in:
Lukas Stevens 2017-10-10 15:35:24 +02:00
parent c0fac7cf56
commit 4438c41d14
2 changed files with 25 additions and 21 deletions

View file

@ -199,10 +199,9 @@ error: called `map_or(None, f)` on an Option value. This can be done more direct
--> $DIR/methods.rs:144:13
|
144 | let _ = opt.map_or(None, |x| Some(x + 1));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using and_then instead: `opt.and_then(|x| Some(x + 1))`
|
= note: `-D option-map-or-none` implied by `-D warnings`
= note: replace `map_or(None, |x| Some(x + 1))` with `and_then(|x| Some(x + 1))`
error: called `map_or(None, f)` on an Option value. This can be done more directly by calling `and_then(f)` instead
--> $DIR/methods.rs:146:13
@ -213,6 +212,13 @@ error: called `map_or(None, f)` on an Option value. This can be done more direct
148 | | }
149 | | );
| |_________________^
|
help: try using and_then instead
|
146 | let _ = opt.and_then(|x| {
147 | Some(x + 1)
148 | });
|
error: unnecessary structure name repetition
--> $DIR/methods.rs:173:24