Skip to content

Commit

Permalink
Rollup merge of rust-lang#131833 - c-ryan747:patch-1, r=Noratrieb
Browse files Browse the repository at this point in the history
Add `must_use` to `CommandExt::exec`

[CommandExt::exec](https://fburl.com/0qhpo7nu) returns a `std::io::Error` in the case exec fails, but its not currently marked as `must_use` making it easy to accidentally ignore it.

This PR adds the `must_use` attributed here as i think it fits the definition in the guide of [When to add #[must_use]](https://std-dev-guide.rust-lang.org/policy/must-use.html#when-to-add-must_use)
  • Loading branch information
matthiaskrgr authored Oct 17, 2024
2 parents 0d7c889 + d73f924 commit bac74b6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions std/src/os/unix/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ pub trait CommandExt: Sealed {
/// required to gracefully handle errors it is recommended to use the
/// cross-platform `spawn` instead.
#[stable(feature = "process_exec2", since = "1.9.0")]
#[must_use]
fn exec(&mut self) -> io::Error;

/// Set executable argument
Expand Down

0 comments on commit bac74b6

Please sign in to comment.