mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
Merge pull request #74 from Arcterus/rm
rm: make InteractiveMode derive Eq
This commit is contained in:
commit
752716c851
1 changed files with 1 additions and 15 deletions
16
rm/rm.rs
16
rm/rm.rs
|
@ -15,27 +15,13 @@ use std::os;
|
||||||
use std::io::{print,stdin,stderr,stdio,fs,BufferedReader,io_error};
|
use std::io::{print,stdin,stderr,stdio,fs,BufferedReader,io_error};
|
||||||
use extra::getopts::groups;
|
use extra::getopts::groups;
|
||||||
|
|
||||||
|
#[deriving(Eq)]
|
||||||
enum InteractiveMode {
|
enum InteractiveMode {
|
||||||
InteractiveNone,
|
InteractiveNone,
|
||||||
InteractiveOnce,
|
InteractiveOnce,
|
||||||
InteractiveAlways
|
InteractiveAlways
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Eq for InteractiveMode {
|
|
||||||
fn eq(&self, other: &InteractiveMode) -> bool {
|
|
||||||
match (*self, *other) {
|
|
||||||
(InteractiveNone, InteractiveNone) |
|
|
||||||
(InteractiveOnce, InteractiveOnce) |
|
|
||||||
(InteractiveAlways, InteractiveAlways) => true,
|
|
||||||
_ => false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn ne(&self, other: &InteractiveMode) -> bool {
|
|
||||||
!self.eq(other)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = os::args();
|
let args = os::args();
|
||||||
let program = args[0].clone();
|
let program = args[0].clone();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue