diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index eb4ff345b51..e4af5795e1c 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -1598,15 +1598,15 @@ mod tests { #[test] fn test_total_ord() { let c: &[int] = &[1, 2, 3]; - [1, 2, 3, 4][].cmp(& c) == Greater; + [1, 2, 3, 4][].cmp(c) == Greater; let c: &[int] = &[1, 2, 3, 4]; - [1, 2, 3][].cmp(& c) == Less; + [1, 2, 3][].cmp(c) == Less; let c: &[int] = &[1, 2, 3, 6]; - [1, 2, 3, 4][].cmp(& c) == Equal; + [1, 2, 3, 4][].cmp(c) == Equal; let c: &[int] = &[1, 2, 3, 4, 5, 6]; - [1, 2, 3, 4, 5, 5, 5, 5][].cmp(& c) == Less; + [1, 2, 3, 4, 5, 5, 5, 5][].cmp(c) == Less; let c: &[int] = &[1, 2, 3, 4]; - [2, 2][].cmp(& c) == Greater; + [2, 2][].cmp(c) == Greater; } #[test] diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 79c1f720794..cdca0d10eed 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -1530,11 +1530,11 @@ mod tests { #[test] fn test_total_ord() { - "1234".cmp(&("123")) == Greater; - "123".cmp(&("1234")) == Less; - "1234".cmp(&("1234")) == Equal; - "12345555".cmp(&("123456")) == Less; - "22".cmp(&("1234")) == Greater; + "1234".cmp("123") == Greater; + "123".cmp("1234") == Less; + "1234".cmp("1234") == Equal; + "12345555".cmp("123456") == Less; + "22".cmp("1234") == Greater; } #[test] diff --git a/src/libcollections/tree/map.rs b/src/libcollections/tree/map.rs index 9742bddb1f6..8e24eabfccf 100644 --- a/src/libcollections/tree/map.rs +++ b/src/libcollections/tree/map.rs @@ -579,7 +579,7 @@ impl TreeMap { /// let headers = get_headers(); /// let ua_key = "User-Agent"; /// let ua = headers.find_with(|k| { - /// ua_key.cmp(&k.as_slice()) + /// ua_key.cmp(k.as_slice()) /// }); /// /// assert_eq!((*ua.unwrap()).as_slice(), "Curl-Rust/0.1"); @@ -603,7 +603,7 @@ impl TreeMap { /// t.insert("User-Agent", "Curl-Rust/0.1"); /// /// let new_ua = "Safari/156.0"; - /// match t.find_with_mut(|k| "User-Agent".cmp(k)) { + /// match t.find_with_mut(|&k| "User-Agent".cmp(k)) { /// Some(x) => *x = new_ua, /// None => panic!(), /// } @@ -1302,7 +1302,7 @@ mod test_treemap { #[test] fn find_with_empty() { let m: TreeMap<&'static str,int> = TreeMap::new(); - assert!(m.find_with(|k| "test".cmp(k)) == None); + assert!(m.find_with(|&k| "test".cmp(k)) == None); } #[test] @@ -1311,7 +1311,7 @@ mod test_treemap { assert!(m.insert("test1", 2i)); assert!(m.insert("test2", 3i)); assert!(m.insert("test3", 3i)); - assert_eq!(m.find_with(|k| "test4".cmp(k)), None); + assert_eq!(m.find_with(|&k| "test4".cmp(k)), None); } #[test] @@ -1320,7 +1320,7 @@ mod test_treemap { assert!(m.insert("test1", 2i)); assert!(m.insert("test2", 3i)); assert!(m.insert("test3", 4i)); - assert_eq!(m.find_with(|k| "test2".cmp(k)), Some(&3i)); + assert_eq!(m.find_with(|&k| "test2".cmp(k)), Some(&3i)); } #[test] @@ -1343,10 +1343,10 @@ mod test_treemap { assert!(m.insert("t2", 8)); assert!(m.insert("t5", 14)); let new = 100; - match m.find_with_mut(|k| "t5".cmp(k)) { + match m.find_with_mut(|&k| "t5".cmp(k)) { None => panic!(), Some(x) => *x = new } - assert_eq!(m.find_with(|k| "t5".cmp(k)), Some(&new)); + assert_eq!(m.find_with(|&k| "t5".cmp(k)), Some(&new)); } #[test] diff --git a/src/test/compile-fail/deriving-no-inner-impl-error-message.rs b/src/test/compile-fail/deriving-no-inner-impl-error-message.rs index 15a7bc01c3a..18be03f97d9 100644 --- a/src/test/compile-fail/deriving-no-inner-impl-error-message.rs +++ b/src/test/compile-fail/deriving-no-inner-impl-error-message.rs @@ -12,8 +12,8 @@ struct NoCloneOrEq; #[deriving(PartialEq)] struct E { - x: NoCloneOrEq //~ ERROR does not implement any method in scope named `eq` - //~^ ERROR does not implement any method in scope named `ne` + x: NoCloneOrEq //~ ERROR binary operation `==` cannot be applied to type `NoCloneOrEq` + //~^ ERROR binary operation `!=` cannot be applied to type `NoCloneOrEq` } #[deriving(Clone)] struct C {