← 输入框|github.com|刷新
Skip to content

get rid of needless string allocations - #7773

Merged
llogiq merged 2 commits into
mainfrom
more-small-stuff
Nov 1, 2026
Merged

llogiq merged 2 commits into
mainfrom
more-small-stuff

Conversation

@llogiq

@llogiq llogiq commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

This is a very small behavior-neutral change to use write!(..) instead of push_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 changed format!(_) 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.

llogiq and others added 2 commits November 1, 2026 16:27
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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug (medium, CI): this doesn't pass cargo fmt --check. rustfmt wants:

Suggested change
Segment::Index(index) => {
Segment::Index(index) => {
let _ = write!(&mut s, "[{index}]");
}

@mythical-fred-oss

Copy link
Copy Markdown
Contributor

This refactor doesn't change behavior, and I checked that the pipeline_logs.rs edit is equivalent: display_name already fell back to "N/A", so the old if was always true. The pre-commit gates fail, though (see inline comments).

Check Result
cargo clippy --no-deps -p feldera-types -p pipeline-manager -- -D warnings ❌ 7 × write_with_newline in support_bundle.rs
rustfmt --edition 2024 --check on changed files ❌ ignored.rs
cargo clippy -p feldera-sqllib -p dbsp -p fda -- -D warnings ✅
cargo test -p feldera-types ignored ✅ 3 passed
cargo test -p pipeline-manager --lib -- support_bundle pipeline_logs ✅ 25 passed
cargo test -p feldera-sqllib flat_variant ✅
  • pitfall (medium): please run pre-commit run --files <changed files> before pushing; the merge queue will reject this as it stands.
  • commit (low): the subject should be capitalized (Remove needless string allocations).

I didn't build feldera-connectors (its change is one line, the same as the others). Existing tests cover the touched paths well enough for a change with no behavior impact.

@llogiq
llogiq added this pull request to the merge queue Nov 1, 2026
Merged via the queue into main with commit 6693026 Nov 1, 2026
1 check passed
@llogiq
llogiq deleted the more-small-stuff branch November 1, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants