diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2014-11-27 19:45:47 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2014-12-06 23:53:02 -0500 |
| commit | c2da923fc95e29424a7dac1505d6e8ea50c49b9f (patch) | |
| tree | 8b47144a56039b4a53519513bce60aa74c1dcf51 /src/libstd/collections | |
| parent | ba01ea3730025028affbf4ce56f29621861779c6 (diff) | |
| download | rust-c2da923fc95e29424a7dac1505d6e8ea50c49b9f.tar.gz rust-c2da923fc95e29424a7dac1505d6e8ea50c49b9f.zip | |
libstd: remove unnecessary `to_string()` calls
Diffstat (limited to 'src/libstd/collections')
| -rw-r--r-- | src/libstd/collections/hash/map.rs | 4 | ||||
| -rw-r--r-- | src/libstd/collections/hash/set.rs | 4 | ||||
| -rw-r--r-- | src/libstd/collections/lru_cache.rs | 12 |
3 files changed, 10 insertions, 10 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 1fb6279d004..ef7fe48b1ad 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -1903,8 +1903,8 @@ mod test_map { let map_str = format!("{}", map); - assert!(map_str == "{1: 2, 3: 4}".to_string() || map_str == "{3: 4, 1: 2}".to_string()); - assert_eq!(format!("{}", empty), "{}".to_string()); + assert!(map_str == "{1: 2, 3: 4}" || map_str == "{3: 4, 1: 2}"); + assert_eq!(format!("{}", empty), "{}"); } #[test] diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index 9c9f23369e5..ebf7a29ad3f 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -862,7 +862,7 @@ mod test_set { let set_str = format!("{}", set); - assert!(set_str == "{1, 2}".to_string() || set_str == "{2, 1}".to_string()); - assert_eq!(format!("{}", empty), "{}".to_string()); + assert!(set_str == "{1, 2}" || set_str == "{2, 1}"); + assert_eq!(format!("{}", empty), "{}"); } } diff --git a/src/libstd/collections/lru_cache.rs b/src/libstd/collections/lru_cache.rs index 94bea37d187..638ccdb1112 100644 --- a/src/libstd/collections/lru_cache.rs +++ b/src/libstd/collections/lru_cache.rs @@ -446,15 +446,15 @@ mod tests { cache.insert(1, 10); cache.insert(2, 20); cache.insert(3, 30); - assert_eq!(cache.to_string(), "{3: 30, 2: 20, 1: 10}".to_string()); + assert_eq!(cache.to_string(), "{3: 30, 2: 20, 1: 10}"); cache.insert(2, 22); - assert_eq!(cache.to_string(), "{2: 22, 3: 30, 1: 10}".to_string()); + assert_eq!(cache.to_string(), "{2: 22, 3: 30, 1: 10}"); cache.insert(6, 60); - assert_eq!(cache.to_string(), "{6: 60, 2: 22, 3: 30}".to_string()); + assert_eq!(cache.to_string(), "{6: 60, 2: 22, 3: 30}"); cache.get(&3); - assert_eq!(cache.to_string(), "{3: 30, 6: 60, 2: 22}".to_string()); + assert_eq!(cache.to_string(), "{3: 30, 6: 60, 2: 22}"); cache.set_capacity(2); - assert_eq!(cache.to_string(), "{3: 30, 6: 60}".to_string()); + assert_eq!(cache.to_string(), "{3: 30, 6: 60}"); } #[test] @@ -465,6 +465,6 @@ mod tests { cache.clear(); assert!(cache.get(&1).is_none()); assert!(cache.get(&2).is_none()); - assert_eq!(cache.to_string(), "{}".to_string()); + assert_eq!(cache.to_string(), "{}"); } } |
