Skip to content

Commit 41118c3

Browse files
authored
Merge pull request #34 from jyn514/fix-clippy
Fix clippy warning: use #[non_exhaustive] instead of manually reimplementing it
2 parents 1282f03 + 5433928 commit 41118c3

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

src/cmd/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ pub(crate) mod container_dirs {
5959

6060
/// Error happened while executing a command.
6161
#[derive(Debug, Fail)]
62+
#[non_exhaustive]
6263
pub enum CommandError {
6364
/// The command didn't output anything to stdout or stderr for more than the timeout, and it
6465
/// was killed. The timeout's value (in seconds) is the first value.
@@ -71,12 +72,10 @@ pub enum CommandError {
7172
/// The sandbox ran out of memory and was killed.
7273
#[fail(display = "container ran out of memory")]
7374
SandboxOOM,
74-
#[doc(hidden)]
75-
#[fail(display = "this error shouldn't have happened")]
76-
__NonExaustive,
7775
}
7876

7977
/// Name and kind of a binary executed by [`Command`](struct.Command.html).
78+
#[non_exhaustive]
8079
pub enum Binary {
8180
/// Global binary, available in `$PATH`. Rustwide doesn't apply any tweaks to its execution
8281
/// environment.
@@ -85,8 +84,6 @@ pub enum Binary {
8584
/// tweak the environment to use the local rustup instead of the host system one, and will
8685
/// search the binary in the cargo home.
8786
ManagedByRustwide(PathBuf),
88-
#[doc(hidden)]
89-
__NonExaustive,
9087
}
9188

9289
/// Trait representing a command that can be run by [`Command`](struct.Command.html).
@@ -313,7 +310,6 @@ impl<'w, 'pl> Command<'w, 'pl> {
313310
Binary::ManagedByRustwide(path) => {
314311
container_dirs::CARGO_BIN_DIR.join(exe_suffix(path.as_os_str()))
315312
}
316-
Binary::__NonExaustive => panic!("do not create __NonExaustive variants manually"),
317313
};
318314

319315
let mut cmd = Vec::new();
@@ -382,7 +378,6 @@ impl<'w, 'pl> Command<'w, 'pl> {
382378
// `cargo_home()` might a relative path
383379
(crate::utils::normalize_path(&binary), true)
384380
}
385-
Binary::__NonExaustive => panic!("do not create __NonExaustive variants manually"),
386381
};
387382

388383
let mut cmd = AsyncCommand::new(&binary);

src/cmd/sandbox.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,12 @@ impl SandboxImage {
6969

7070
/// Whether to mount a path in the sandbox with write permissions or not.
7171
#[derive(Copy, Clone, PartialEq, Eq)]
72+
#[non_exhaustive]
7273
pub enum MountKind {
7374
/// Allow the sandboxed code to change the mounted data.
7475
ReadWrite,
7576
/// Prevent the sandboxed code from changing the mounted data.
7677
ReadOnly,
77-
#[doc(hidden)]
78-
__NonExaustive,
7978
}
8079

8180
#[derive(Clone)]
@@ -108,7 +107,6 @@ impl MountConfig {
108107
let perm = match self.perm {
109108
MountKind::ReadWrite => "rw",
110109
MountKind::ReadOnly => "ro",
111-
MountKind::__NonExaustive => panic!("do not create __NonExaustive variants manually"),
112110
};
113111
Ok(format!(
114112
"{}:{}:{},Z",

src/prepare.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ impl<'a> TomlTweaker<'a> {
373373

374374
/// Error happened while preparing a crate for a build.
375375
#[derive(Debug, Fail)]
376+
#[non_exhaustive]
376377
pub enum PrepareError {
377378
/// The git repository isn't publicly available.
378379
#[fail(display = "can't fetch private git repositories")]
@@ -387,9 +388,6 @@ pub enum PrepareError {
387388
/// Some of this crate's dependencies were yanked, preventing Crater from fetching them.
388389
#[fail(display = "the crate depends on yanked dependencies")]
389390
YankedDependencies,
390-
#[doc(hidden)]
391-
#[fail(display = "this error shouldn't have happened")]
392-
__NonExaustive,
393391
}
394392

395393
#[cfg(test)]

0 commit comments

Comments
 (0)