Skip to content

Commit 4589411

Browse files
committed
Clippy cleanup
1 parent 75a26cd commit 4589411

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

src/mount/bsd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ impl<'a> Nmount<'a> {
391391
});
392392

393393
let niov = self.iov.len() as c_uint;
394-
let iovp = self.iov.as_mut_ptr() as *mut libc::iovec;
394+
let iovp = self.iov.as_mut_ptr();
395395
let res = unsafe { libc::nmount(iovp, niov, flags.bits()) };
396396
match Errno::result(res) {
397397
Ok(_) => Ok(()),

src/sys/socket/addr.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ enum UnixAddrKind<'a> {
484484
}
485485
impl<'a> UnixAddrKind<'a> {
486486
/// Safety: sun & sun_len must be valid
487+
#[allow(clippy::unnecessary_cast)] // Not unnecessary on all platforms
487488
unsafe fn get(sun: &'a libc::sockaddr_un, sun_len: u8) -> Self {
488489
assert!(sun_len as usize >= offset_of!(libc::sockaddr_un, sun_path));
489490
let path_len =
@@ -520,6 +521,7 @@ impl<'a> UnixAddrKind<'a> {
520521

521522
impl UnixAddr {
522523
/// Create a new sockaddr_un representing a filesystem path.
524+
#[allow(clippy::unnecessary_cast)] // Not unnecessary on all platforms
523525
pub fn new<P: ?Sized + NixPath>(path: &P) -> Result<UnixAddr> {
524526
path.with_nix_path(|cstr| unsafe {
525527
let mut ret = libc::sockaddr_un {
@@ -567,6 +569,7 @@ impl UnixAddr {
567569
/// processes to communicate with processes having a different filesystem view.
568570
#[cfg(any(target_os = "android", target_os = "linux"))]
569571
#[cfg_attr(docsrs, doc(cfg(all())))]
572+
#[allow(clippy::unnecessary_cast)] // Not unnecessary on all platforms
570573
pub fn new_abstract(path: &[u8]) -> Result<UnixAddr> {
571574
unsafe {
572575
let mut ret = libc::sockaddr_un {

src/sys/socket/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2234,7 +2234,7 @@ pub fn recvfrom<T: SockaddrLike>(
22342234
Ok((
22352235
ret,
22362236
T::from_raw(
2237-
addr.assume_init().as_ptr() as *const sockaddr,
2237+
addr.assume_init().as_ptr(),
22382238
Some(len),
22392239
),
22402240
))

test/test_fcntl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ mod linux_android {
340340

341341
let buf1 = b"abcdef";
342342
let buf2 = b"defghi";
343-
let iovecs = vec![IoSlice::new(&buf1[0..3]), IoSlice::new(&buf2[0..3])];
343+
let iovecs = [IoSlice::new(&buf1[0..3]), IoSlice::new(&buf2[0..3])];
344344

345345
let res = vmsplice(wr, &iovecs[..], SpliceFFlags::empty()).unwrap();
346346

test/test_sendfile.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ fn test_sendfile64_linux() {
7272
fn test_sendfile_freebsd() {
7373
// Declare the content
7474
let header_strings =
75-
vec!["HTTP/1.1 200 OK\n", "Content-Type: text/plain\n", "\n"];
75+
["HTTP/1.1 200 OK\n", "Content-Type: text/plain\n", "\n"];
7676
let body = "Xabcdef123456";
7777
let body_offset = 1;
78-
let trailer_strings = vec!["\n", "Served by Make Believe\n"];
78+
let trailer_strings = ["\n", "Served by Make Believe\n"];
7979

8080
// Write the body to a file
8181
let mut tmp = tempfile().unwrap();
@@ -123,10 +123,10 @@ fn test_sendfile_freebsd() {
123123
fn test_sendfile_dragonfly() {
124124
// Declare the content
125125
let header_strings =
126-
vec!["HTTP/1.1 200 OK\n", "Content-Type: text/plain\n", "\n"];
126+
["HTTP/1.1 200 OK\n", "Content-Type: text/plain\n", "\n"];
127127
let body = "Xabcdef123456";
128128
let body_offset = 1;
129-
let trailer_strings = vec!["\n", "Served by Make Believe\n"];
129+
let trailer_strings = ["\n", "Served by Make Believe\n"];
130130

131131
// Write the body to a file
132132
let mut tmp = tempfile().unwrap();

0 commit comments

Comments
 (0)