Repository navigation
get rid of needless string allocations - #7773
Conversation
Signed-off-by: feldera-bot <feldera-bot@feldera.com>
| )); | ||
| out.push_str(&format!( | ||
| "Pipeline Status: {} (since {})\n", | ||
| let _ = writeln!(&mut out, "Pipeline: {}", meta.pipeline.name); |
There was a problem hiding this comment.
bug (high, CI): cargo clippy -p pipeline-manager -- -D warnings fails with 7 × clippy::write_with_newline in this function (lines 210, 211, 216, 223, 237, 243, 249). Use writeln! and drop the trailing \n, e.g.
| let _ = writeln!(&mut out, "Pipeline: {}", meta.pipeline.name); | |
| let _ = writeln!(&mut out, "Pipeline: {}", meta.pipeline.name); |
| s.push_str(key); | ||
| } | ||
| Segment::Index(index) => s.push_str(&format!("[{index}]")), | ||
| Segment::Index(index) => { |
There was a problem hiding this comment.
bug (medium, CI): this doesn't pass cargo fmt --check. rustfmt wants:
| Segment::Index(index) => { | |
| Segment::Index(index) => { | |
| let _ = write!(&mut s, "[{index}]"); | |
| } |
|
This refactor doesn't change behavior, and I checked that the
I didn't build |
This is a very small behavior-neutral change to use
write!(..)instead ofpush_str(format!(..))in all relevant code. There is also one change that removes a branch for getting a usize for a bool, some places where I changedformat!(_)invocations to using embedded syntax, and one point where I use the.midpoint(_)method instead of using the manual implementation that might overflow (although that is probably not going to happen in practice).All tests run unchanged.