-
Notifications
You must be signed in to change notification settings - Fork 666
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
Conversation
@@ -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()); |
There was a problem hiding this comment.
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 🤔
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
test_sendfile_dragonfly/test_recverr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
remove as_bytes().len() calls when we can call len() on strings. ``` error: needless call to `as_bytes()` ```
oh you did already :) |
No description provided.