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

chore(volo-thrift): fix clippy warning needless_as_bytes #529

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

yukiiiteru
Copy link
Member

Motivation

https://rust-lang.github.io/rust-clippy/master/index.html#needless_as_bytes

error: needless call to `as_bytes()`
   --> volo-thrift/src/codec/default/ttheader.rs:389:37
    |
389 |                         dst.put_u16(TT_HEADER_BIZ_STATUS_KEY.as_bytes().len() as u16);
    |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: `len()` can be called directly on strings: `TT_HEADER_BIZ_STATUS_KEY.len()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_as_bytes
    = note: `-D clippy::needless-as-bytes` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::needless_as_bytes)]`

Solution

Remote .as_bytes()

https://rust-lang.github.io/rust-clippy/master/index.html#needless_as_bytes

```
error: needless call to `as_bytes()`
   --> volo-thrift/src/codec/default/ttheader.rs:389:37
    |
389 |                         dst.put_u16(TT_HEADER_BIZ_STATUS_KEY.as_bytes().len() as u16);
    |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: `len()` can be called directly on strings: `TT_HEADER_BIZ_STATUS_KEY.len()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_as_bytes
    = note: `-D clippy::needless-as-bytes` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::needless_as_bytes)]`
```

Signed-off-by: Yu Li <liyu.yukiteru@bytedance.com>
@yukiiiteru yukiiiteru requested review from a team as code owners November 11, 2024 06:47
@yukiiiteru yukiiiteru merged commit d6af79e into cloudwego:main Nov 11, 2024
13 checks passed
@yukiiiteru yukiiiteru deleted the chore/fix-clippy branch November 18, 2024 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants