Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/sys/test_socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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

assert_eq!(msg.bytes, MESSAGE_CONTENTS.len());
// recvmsg(2): "The original destination address of the datagram that caused the error is
// supplied via msg_name;" however, this is not literally true. E.g., an earlier version
// of this test used 0.0.0.0 (::0) as the destination address, which was mutated into
Expand Down
2 changes: 1 addition & 1 deletion test/test_sendfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ fn test_sendfile_dragonfly() {
+ &trailer_strings.concat();

// Verify the message that was sent
assert_eq!(bytes_written as usize, expected_string.as_bytes().len());
assert_eq!(bytes_written as usize, expected_string.len());

let mut read_string = String::new();
let bytes_read = rd.read_to_string(&mut read_string).unwrap();
Expand Down