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

clippy cleanup: needless as_bytes() in tests test_sendfile_dragonfly/test_recverr #2534

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

devnexen
Copy link
Contributor

No description provided.

@@ -2914,7 +2914,7 @@ mod linux_errqueue {
)
.unwrap();
// The sent message / destination associated with the error is returned:
assert_eq!(msg.bytes, MESSAGE_CONTENTS.as_bytes().len());
Copy link
Member

Choose a reason for hiding this comment

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

Could you please tell me what error you got before this PR, looks like they are equivalent and both return the length in bytes 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is pedantism

error: needless call to `as_bytes()`
   --> test/test_sendfile.rs:146:40
    |
146 |     assert_eq!(bytes_written as usize, expected_string.as_bytes().len());
    |                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: `len()` can be called directly on strings: `expected_string.len()`

same reason for both.

Copy link
Member

Choose a reason for hiding this comment

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

In the commit message, you should name what error you're fixing.

Copy link
Member

Choose a reason for hiding this comment

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

This is a clippy cleanup, not a fix, so let's update the PR title a bit since it will be used as the commit message

@SteveLauC SteveLauC changed the title fix test_sendfile_dragonfly/test_recverr tests. clippy cleanup: needless as_bytes() in tests test_sendfile_dragonfly/test_recverr Nov 11, 2024
Copy link
Member

@SteveLauC SteveLauC left a comment

Choose a reason for hiding this comment

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

Thanks!

@SteveLauC SteveLauC added this pull request to the merge queue Nov 11, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 11, 2024
remove as_bytes().len() calls when we can call len() on strings.
```
error: needless call to `as_bytes()`
```
@devnexen
Copy link
Contributor Author

oh you did already :)

@SteveLauC SteveLauC added this pull request to the merge queue Nov 12, 2024
Merged via the queue into nix-rust:master with commit 7e30152 Nov 12, 2024
39 checks passed
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