about summary refs log tree commit diff
path: root/src/libstd/sync
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-12-08 02:32:31 +0000
committerbors <bors@rust-lang.org>2014-12-08 02:32:31 +0000
commit83a44c7fa676b4e5e546ce3d4624e585f9a1e899 (patch)
tree36d7db1d2567d86816d4ac6a1ec86276974dbc65 /src/libstd/sync
parent8bca470c5acf13aa20022a2c462a89f72de721fc (diff)
parent1fea900de7f11d665086141806246842c03b9fc5 (diff)
downloadrust-83a44c7fa676b4e5e546ce3d4624e585f9a1e899.tar.gz
rust-83a44c7fa676b4e5e546ce3d4624e585f9a1e899.zip
auto merge of #19378 : japaric/rust/no-as-slice, r=alexcrichton
Now that we have an overloaded comparison (`==`) operator, and that `Vec`/`String` deref to `[T]`/`str` on method calls, many `as_slice()`/`as_mut_slice()`/`to_string()` calls have become redundant. This patch removes them. These were the most common patterns:

- `assert_eq(test_output.as_slice(), "ground truth")` -> `assert_eq(test_output, "ground truth")`
- `assert_eq(test_output, "ground truth".to_string())` -> `assert_eq(test_output, "ground truth")`
- `vec.as_mut_slice().sort()` -> `vec.sort()`
- `vec.as_slice().slice(from, to)` -> `vec.slice(from_to)`

---

Note that e.g. `a_string.push_str(b_string.as_slice())` has been left untouched in this PR, since we first need to settle down whether we want to favor the `&*b_string` or the `b_string[]` notation.

This is rebased on top of #19167

cc @alexcrichton @aturon 
Diffstat (limited to 'src/libstd/sync')
-rw-r--r--src/libstd/sync/future.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs
index 79e0d487cad..a8c9983e5aa 100644
--- a/src/libstd/sync/future.rs
+++ b/src/libstd/sync/future.rs
@@ -153,7 +153,7 @@ mod test {
     #[test]
     fn test_from_value() {
         let mut f = Future::from_value("snail".to_string());
-        assert_eq!(f.get(), "snail".to_string());
+        assert_eq!(f.get(), "snail");
     }
 
     #[test]
@@ -161,25 +161,25 @@ mod test {
         let (tx, rx) = channel();
         tx.send("whale".to_string());
         let mut f = Future::from_receiver(rx);
-        assert_eq!(f.get(), "whale".to_string());
+        assert_eq!(f.get(), "whale");
     }
 
     #[test]
     fn test_from_fn() {
         let mut f = Future::from_fn(proc() "brail".to_string());
-        assert_eq!(f.get(), "brail".to_string());
+        assert_eq!(f.get(), "brail");
     }
 
     #[test]
     fn test_interface_get() {
         let mut f = Future::from_value("fail".to_string());
-        assert_eq!(f.get(), "fail".to_string());
+        assert_eq!(f.get(), "fail");
     }
 
     #[test]
     fn test_interface_unwrap() {
         let f = Future::from_value("fail".to_string());
-        assert_eq!(f.unwrap(), "fail".to_string());
+        assert_eq!(f.unwrap(), "fail");
     }
 
     #[test]
@@ -191,7 +191,7 @@ mod test {
     #[test]
     fn test_spawn() {
         let mut f = Future::spawn(proc() "bale".to_string());
-        assert_eq!(f.get(), "bale".to_string());
+        assert_eq!(f.get(), "bale");
     }
 
     #[test]