Skip to content

Commit a67007d

Browse files
bors[bot]asomers
andcommitted
Merge #2076
2076: Clippy cleanup r=asomers a=asomers Co-authored-by: Alan Somers <asomers@gmail.com>
1 parent 0c3afc2 commit a67007d

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
@@ -770,6 +770,7 @@ enum UnixAddrKind<'a> {
770770
}
771771
impl<'a> UnixAddrKind<'a> {
772772
/// Safety: sun & sun_len must be valid
773+
#[allow(clippy::unnecessary_cast)] // Not unnecessary on all platforms
773774
unsafe fn get(sun: &'a libc::sockaddr_un, sun_len: u8) -> Self {
774775
assert!(sun_len as usize >= offset_of!(libc::sockaddr_un, sun_path));
775776
let path_len =
@@ -806,6 +807,7 @@ impl<'a> UnixAddrKind<'a> {
806807

807808
impl UnixAddr {
808809
/// Create a new sockaddr_un representing a filesystem path.
810+
#[allow(clippy::unnecessary_cast)] // Not unnecessary on all platforms
809811
pub fn new<P: ?Sized + NixPath>(path: &P) -> Result<UnixAddr> {
810812
path.with_nix_path(|cstr| unsafe {
811813
let mut ret = libc::sockaddr_un {
@@ -853,6 +855,7 @@ impl UnixAddr {
853855
/// processes to communicate with processes having a different filesystem view.
854856
#[cfg(any(target_os = "android", target_os = "linux"))]
855857
#[cfg_attr(docsrs, doc(cfg(all())))]
858+
#[allow(clippy::unnecessary_cast)] // Not unnecessary on all platforms
856859
pub fn new_abstract(path: &[u8]) -> Result<UnixAddr> {
857860
unsafe {
858861
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
@@ -2241,7 +2241,7 @@ pub fn recvfrom<T: SockaddrLike>(
22412241
Ok((
22422242
ret,
22432243
T::from_raw(
2244-
addr.assume_init().as_ptr() as *const libc::sockaddr,
2244+
addr.assume_init().as_ptr(),
22452245
Some(len),
22462246
),
22472247
))

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
@@ -63,10 +63,10 @@ fn test_sendfile64_linux() {
6363
fn test_sendfile_freebsd() {
6464
// Declare the content
6565
let header_strings =
66-
vec!["HTTP/1.1 200 OK\n", "Content-Type: text/plain\n", "\n"];
66+
["HTTP/1.1 200 OK\n", "Content-Type: text/plain\n", "\n"];
6767
let body = "Xabcdef123456";
6868
let body_offset = 1;
69-
let trailer_strings = vec!["\n", "Served by Make Believe\n"];
69+
let trailer_strings = ["\n", "Served by Make Believe\n"];
7070

7171
// Write the body to a file
7272
let mut tmp = tempfile().unwrap();
@@ -114,10 +114,10 @@ fn test_sendfile_freebsd() {
114114
fn test_sendfile_dragonfly() {
115115
// Declare the content
116116
let header_strings =
117-
vec!["HTTP/1.1 200 OK\n", "Content-Type: text/plain\n", "\n"];
117+
["HTTP/1.1 200 OK\n", "Content-Type: text/plain\n", "\n"];
118118
let body = "Xabcdef123456";
119119
let body_offset = 1;
120-
let trailer_strings = vec!["\n", "Served by Make Believe\n"];
120+
let trailer_strings = ["\n", "Served by Make Believe\n"];
121121

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

0 commit comments

Comments
 (0)