Skip to content

Commit 36c0e04

Browse files
author
Eric Reed
committed
derived instances of Eq and TotalEq for IpAddr rather than implement them manually.
1 parent ac49b74 commit 36c0e04

File tree

1 file changed

+1
-21
lines changed
  • src/libstd/rt/io/net

1 file changed

+1
-21
lines changed

src/libstd/rt/io/net/ip.rs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::cmp::{Eq, TotalEq};
12-
11+
#[deriving(Eq, TotalEq)]
1312
pub enum IpAddr {
1413
Ipv4(u8, u8, u8, u8, u16),
1514
Ipv6
1615
}
17-
18-
impl Eq for IpAddr {
19-
fn eq(&self, other: &IpAddr) -> bool {
20-
match (*self, *other) {
21-
(Ipv4(a,b,c,d,e), Ipv4(f,g,h,i,j)) => (a,b,c,d,e) == (f,g,h,i,j),
22-
(Ipv6, Ipv6) => fail!(),
23-
_ => false
24-
}
25-
}
26-
fn ne(&self, other: &IpAddr) -> bool {
27-
!(self == other)
28-
}
29-
}
30-
31-
impl TotalEq for IpAddr {
32-
fn equals(&self, other: &IpAddr) -> bool {
33-
*self == *other
34-
}
35-
}

0 commit comments

Comments
 (0)