Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate an allocation from Literal::byte_string #328

Merged
merged 2 commits into from May 6, 2022
Merged

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented May 6, 2022

As raised by this Clippy lint:

error: `format!(..)` appended to existing `String`
   --> src/fallback.rs:879:22
    |
879 |                 _ => escaped.push_str(&format!("\\x{:02X}", b)),
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `-D clippy::format-push-string` implied by `-D clippy::all`
    = help: consider using `write!` to avoid the extra allocation
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#format_push_string

    error: `format!(..)` appended to existing `String`
       --> src/fallback.rs:879:22
        |
    879 |                 _ => escaped.push_str(&format!("\\x{:02X}", b)),
        |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: `-D clippy::format-push-string` implied by `-D clippy::all`
        = help: consider using `write!` to avoid the extra allocation
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#format_push_string
    error[E0658]: renaming imports with `_` is unstable (see issue 48216)
     --> src/fallback.rs:7:38
      |
    7 | use std::fmt::{self, Debug, Display, Write as _};
      |                                      ^^^^^^^^^^
@dtolnay dtolnay merged commit 4445659 into master May 6, 2022
@dtolnay dtolnay deleted the formatpushstring branch May 6, 2022 04:43
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.

None yet

1 participant