diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2013-01-25 11:57:51 -0800 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2013-01-25 11:57:51 -0800 |
| commit | 85a34c2898b6a64f319f288e69b8cd433a660a17 (patch) | |
| tree | 901255df7138d69cda1affc99ed1a6da77ef1e1c /src/libstd | |
| parent | 4a7e1ab3745f519536ef6e0377427fc41e47f7c6 (diff) | |
| parent | e4337a9defcad3f2a65da285ab78f8ede554f379 (diff) | |
Merge pull request #4625 from thestinger/container
more little container improvements
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/bigint.rs | 2 | ||||
| -rw-r--r-- | src/libstd/flatpipes.rs | 4 | ||||
| -rw-r--r-- | src/libstd/getopts.rs | 6 | ||||
| -rw-r--r-- | src/libstd/list.rs | 9 |
4 files changed, 6 insertions, 15 deletions
diff --git a/src/libstd/bigint.rs b/src/libstd/bigint.rs index 678565ee325..fc783429126 100644 --- a/src/libstd/bigint.rs +++ b/src/libstd/bigint.rs @@ -402,7 +402,7 @@ pub impl BigUint { } pure fn is_zero(&self) -> bool { self.data.is_empty() } - pure fn is_not_zero(&self) -> bool { self.data.is_not_empty() } + pure fn is_not_zero(&self) -> bool { !self.data.is_empty() } pure fn is_positive(&self) -> bool { self.is_not_zero() } pure fn is_negative(&self) -> bool { false } pure fn is_nonpositive(&self) -> bool { self.is_zero() } diff --git a/src/libstd/flatpipes.rs b/src/libstd/flatpipes.rs index 534f1b7d479..ea7b2442bb9 100644 --- a/src/libstd/flatpipes.rs +++ b/src/libstd/flatpipes.rs @@ -599,7 +599,7 @@ pub mod bytepipes { } else if self.buf.is_empty() { match self.port.try_recv() { Some(move buf) => { - assert buf.is_not_empty(); + assert !buf.is_empty(); self.buf = move buf; return self.try_recv(count); } @@ -904,7 +904,7 @@ mod test { fn pipe_port_loader(bytes: ~[u8] ) -> pod::PipePort<int> { let (port, chan) = pipes::stream(); - if bytes.is_not_empty() { + if !bytes.is_empty() { chan.send(move bytes); } pod::pipe_port(move port) diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs index e3cc6797abf..b3e5854bf45 100644 --- a/src/libstd/getopts.rs +++ b/src/libstd/getopts.rs @@ -45,7 +45,7 @@ * } * * fn main(args: ~[str]) { - * check vec::is_not_empty(args); + * check !args.is_empty() * * let program : str = vec::head(args); * @@ -63,7 +63,7 @@ * return; * } * let output = opt_maybe_str(matches, "o"); - * let input = if vec::is_not_empty(matches.free) { + * let input = if !matches.free.is_empty() { * matches.free[0] * } else { * print_usage(program); @@ -357,7 +357,7 @@ fn opt_val(mm: &Matches, nm: &str) -> Optval { return opt_vals(mm, nm)[0]; } /// Returns true if an option was matched pub fn opt_present(mm: &Matches, nm: &str) -> bool { - opt_vals(mm, nm).is_not_empty() + !opt_vals(mm, nm).is_empty() } /// Returns the number of times an option was matched diff --git a/src/libstd/list.rs b/src/libstd/list.rs index 2d9c96b28a9..0aee29932c5 100644 --- a/src/libstd/list.rs +++ b/src/libstd/list.rs @@ -83,11 +83,6 @@ pub pure fn is_empty<T: Copy>(ls: @List<T>) -> bool { } } -/// Returns true if the list is not empty -pub pure fn is_not_empty<T: Copy>(ls: @List<T>) -> bool { - return !is_empty(ls); -} - /// Returns the length of a list pub pure fn len<T>(ls: @List<T>) -> uint { let mut count = 0u; @@ -177,10 +172,6 @@ mod tests { assert is_empty(empty); assert !is_empty(full1); assert !is_empty(full2); - - assert !is_not_empty(empty); - assert is_not_empty(full1); - assert is_not_empty(full2); } #[test] |
