refactor: inline format! args in a few places#10730
Conversation
nyurik
commented
Feb 5, 2026
- in one spot remove redundant mem alloc
|
I was trying to do some research into why this couldn't be enabled as a clippy rule so that this can be applied going forward and I think I was able to replicate the changes with This change already brings it down from 20 to 3, I'm curious if there was something used to generate this or this was just through reading of the codebase? |
| (Ok(c), Err(v)) => Err(BadSequence::MultipleCharInEquivalence(format!( | ||
| "{}{}", | ||
| String::from_utf8_lossy(&[c]).into_owned(), | ||
| String::from_utf8_lossy(v).into_owned() |
There was a problem hiding this comment.
For future reference this was the redundant memory allocation
|
sadly no - just did a late night regex search :) I tried the lint approach at first, but it was not working for me for some reason - I figured it was due to features or specifics of the platform (i'm on linux)... And yes, i think we should add the clippy setting - i'll do it. |
|
ah yes, one other thing -- |
9a6a124 to
87c3dd1
Compare
|
GNU testsuite comparison: |
|
P.S. I tried to fix the compiler bug with rust-lang/rust#152190 -- if merged, in 3 months we can have all format-like macros auto-fixed by clippy |
|
GNU testsuite comparison: |
* in one spot remove redundant mem alloc
|
ci breakage again, conflicts with 181b247 |
|
I wonder if CI can be stabilized somehow - rust project has far larger number of changes and yet the code tends to be more stable. The lowest hanging fruit might be to have early "tidy" warnings - so that each CI run reports fmt/clippy issues much within a few minutes of the commit? |
The usual way to solve this problem is with a merge queue. |