Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add #[must_use] to remaining std functions (O-Z) #90431

Merged
merged 1 commit into from
Oct 31, 2021

Conversation

jkugelman
Copy link
Contributor

I've run out of compelling reasons to group functions together across crates so I'm just going to go module-by-module. This is half of the remaining items from the std crate, from O-Z.

panicking::take_hook has a side effect: it unregisters the current panic hook, returning it. I almost ignored it, but the documentation example shows let _ = panic::take_hook();, so following suit I went ahead and added a #[must_use].

std::panicking   fn take_hook() -> Box<dyn Fn(&PanicInfo<'_>) + 'static + Sync + Send>;

I added these functions that clippy did not flag:

std::path::Path   fn starts_with<P: AsRef<Path>>(&self, base: P) -> bool;
std::path::Path   fn ends_with<P: AsRef<Path>>(&self, child: P) -> bool;
std::path::Path   fn with_file_name<S: AsRef<OsStr>>(&self, file_name: S) -> PathBuf;
std::path::Path   fn with_extension<S: AsRef<OsStr>>(&self, extension: S) -> PathBuf;

Parent issue: #89692

r? @joshtriplett

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 31, 2021
@joshtriplett
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Oct 31, 2021

📌 Commit a81d4b1 has been approved by joshtriplett

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 31, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 31, 2021
…askrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#89068 (Restructure std::rt (part 2))
 - rust-lang#89786 (Add #[must_use] to len and is_empty)
 - rust-lang#90430 (Add #[must_use] to remaining std functions (A-N))
 - rust-lang#90431 (Add #[must_use] to remaining std functions (O-Z))

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 455a79a into rust-lang:master Oct 31, 2021
@rustbot rustbot added this to the 1.58.0 milestone Oct 31, 2021
@jkugelman jkugelman deleted the must-use-std-o-through-z branch October 31, 2021 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants