diff options
| author | bors <bors@rust-lang.org> | 2020-10-16 22:53:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-10-16 22:53:50 +0000 |
| commit | f1b97ee7f8ffb1a814944b85c7e05a1555a7eda5 (patch) | |
| tree | a09ab9ebf54ef7a50003494a066bbc48f429b2ac | |
| parent | e3051d8c24467b54c81da9d9ad70a3e82e106ec1 (diff) | |
| parent | 0b062887db9be8fe05791411dd08ca35683cedc8 (diff) | |
| download | rust-f1b97ee7f8ffb1a814944b85c7e05a1555a7eda5.tar.gz rust-f1b97ee7f8ffb1a814944b85c7e05a1555a7eda5.zip | |
Auto merge of #77997 - fusion-engineering-forks:to-string-no-shrink, r=joshtriplett
Remove shrink_to_fit from default ToString::to_string implementation. As suggested by `@scottmcm` on Zulip. shrink_to_fit() seems like the wrong thing to do here in most use cases of to_string(). Would be intereseting to see if it makes any difference in a timer run. r? `@joshtriplett`
| -rw-r--r-- | library/alloc/src/string.rs | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index d3598ccfce8..dc67d903a1d 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -2200,7 +2200,6 @@ impl<T: fmt::Display + ?Sized> ToString for T { let mut buf = String::new(); buf.write_fmt(format_args!("{}", self)) .expect("a Display implementation returned an error unexpectedly"); - buf.shrink_to_fit(); buf } } |
