Skip to content

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

Merged
yukiiiteru merged 1 commit intocloudwego:mainfrom
yukiiiteru:chore/fix-clippy
Nov 11, 2024
Merged

chore(volo-thrift): fix clippy warning needless_as_bytes#529
yukiiiteru merged 1 commit intocloudwego:mainfrom
yukiiiteru:chore/fix-clippy

Conversation

@yukiiiteru
Copy link
Copy Markdown
Contributor

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
@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