Don't format!() string literals#52805
Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Using String::new() instead of "".to_string() would be even faster. (Similar for every other occurrences)
There was a problem hiding this comment.
We should keep the unwrap_or_else where. .to_string() is not free.
01bed0e to
421b2ba
Compare
|
@kennytm thanks, done. |
|
@bors r+ |
|
📌 Commit 421b2ba has been approved by |
Don't format!() string literals
Prefer `to_string()` to `format!()` take 2, this time targetting string literals. In some cases (`&format!("...")` -> `"..."`) also removes allocations. Occurences of `format!("")` are changed to `String::new()`.
|
💔 Test failed - status-appveyor |
Spurious? |
|
@bors retry |
|
⌛ Testing commit 421b2ba with merge 6a3fada2b42a3fba3e4d872d555d743ab711b999... |
|
💔 Test failed - status-travis |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
@bors retry |
|
⌛ Testing commit 421b2ba with merge 988b7451140651f904f5d8147a0d4accb2f7e6c2... |
|
💔 Test failed - status-travis |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Don't format!() string literals
Prefer `to_string()` to `format!()` take 2, this time targetting string literals. In some cases (`&format!("...")` -> `"..."`) also removes allocations. Occurences of `format!("")` are changed to `String::new()`.
|
☀️ Test successful - status-appveyor, status-travis |
Prefer
to_string()toformat!()take 2, this time targetting string literals. In some cases (&format!("...")->"...") also removes allocations. Occurences offormat!("")are changed toString::new().