option: rm functions that duplicate methods#5414
Closed
thestinger wants to merge 1 commit intorust-lang:incomingfrom
thestinger:option
Closed
option: rm functions that duplicate methods#5414thestinger wants to merge 1 commit intorust-lang:incomingfrom thestinger:option
thestinger wants to merge 1 commit intorust-lang:incomingfrom
thestinger:option
Conversation
Contributor
|
I'm in favor of doing this for all of core and std but I think it requires some discussion. Last time this was brought up @catamorphism had some concerns. We do have plans to make methods also usable as functions, which would give us the best of both worlds. |
Contributor
|
@thestinger , can you rebase? Since the eventual plan is to have a way to treat methods as functions, I'm ok with merging this. Thanks! |
bors
added a commit
that referenced
this pull request
Mar 27, 2013
oli-obk
pushed a commit
to oli-obk/rust
that referenced
this pull request
May 2, 2020
Add new lint for `Result<T, E>.map_or(None, Some(T))` Fixes rust-lang#5414 PR Checklist --- - [x] Followed lint naming conventions (the name is a bit awkward, but it seems to conform) - [x] Added passing UI tests (including committed .stderr file) - [x] cargo test passes locally - [x] Executed cargo dev update_lints - [x] Added lint documentation - [x] Run cargo dev fmt `Result<T, E>` has an [`ok()`](https://doc.rust-lang.org/std/result/enum.Result.html#method.ok) method that adapts a `Result<T,E>` into an `Option<T>`. It's possible to get around this adapter by writing `Result<T,E>.map_or(None, Some)`. This lint is implemented as a new variant of the existing [`option_map_none` lint](rust-lang/rust-clippy#2128)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.