Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd #[must_use] to a few standard library methods #49533
Conversation
This comment has been minimized.
This comment has been minimized.
|
Looks like highfive was asleep for this one, so picking, from the |
rust-highfive
assigned
nikomatsakis
Apr 1, 2018
This comment has been minimized.
This comment has been minimized.
|
@bors r+ |
This comment has been minimized.
This comment has been minimized.
|
|
bors
added
the
S-waiting-on-bors
label
Apr 2, 2018
cramertj
reviewed
Apr 2, 2018
| @@ -1368,6 +1368,7 @@ pub trait Iterator { | |||
| /// [`Result`]: ../../std/result/enum.Result.html | |||
| #[inline] | |||
| #[stable(feature = "rust1", since = "1.0.0")] | |||
| #[must_use = "if you really need to exhaust the iterator, consider `.for_each(drop)` instead"] | |||
This comment has been minimized.
This comment has been minimized.
cramertj
Apr 2, 2018
Member
I think this is going to be annoying for the "collect to unit" use-case. I don't know how much we want to support that, but I thought it worth pointing out.
This comment has been minimized.
This comment has been minimized.
ExpHP
Apr 2, 2018
•
Contributor
AFAICT Unit-returning functions never trigger the warning, even if they are the result of monomorphising a function generic in its output type. Also, there's a use case for that FromIterator implementation besides just making collect::<Result<()>> work?
kennytm
added a commit
to kennytm/rust
that referenced
this pull request
Apr 3, 2018
kennytm
added a commit
to kennytm/rust
that referenced
this pull request
Apr 3, 2018
bors
added a commit
that referenced
this pull request
Apr 3, 2018
kennytm
added a commit
to kennytm/rust
that referenced
this pull request
Apr 4, 2018
bors
added a commit
that referenced
this pull request
Apr 4, 2018
bors
added a commit
that referenced
this pull request
Apr 4, 2018
alexcrichton
merged commit fb7deda
into
rust-lang:master
Apr 5, 2018
1 check passed
continuous-integration/travis-ci/pr
The Travis CI build passed
Details
scottmcm
deleted the
scottmcm:more-must-use
branch
Apr 5, 2018
scottmcm
referenced this pull request
Apr 5, 2018
Open
discussion/tracking issue for `#[must_use]` functions in the standard library #48926
zackmdavis
referenced this pull request
Sep 24, 2018
Open
Tracking issue for RFC 2383, "Lint Reasons RFC" #54503
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.
scottmcm commentedMar 31, 2018
Chosen to start a precedent of using it on ones that are potentially-expensive and where using it for side effects is particularly discouraged.
Discuss :)
cc #48926