Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 64a9360

Browse files
Rollup merge of rust-lang#123083 - klensy:clippy-me, r=workingjubilee
lib: fix some unnecessary_cast clippy lint Fixes few instances of `unnecessary_cast` clippy lint
2 parents dc4236d + 8560d01 commit 64a9360

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

‎library/alloc/src/collections/btree/map/entry.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ impl<'a, K: Ord, V, A: Allocator + Clone> VacantEntry<'a, K, V, A> {
354354
// SAFETY: There is no tree yet so no reference to it exists.
355355
let map = unsafe { self.dormant_map.awaken() };
356356
let mut root = NodeRef::new_leaf(self.alloc.clone());
357-
let val_ptr = root.borrow_mut().push(self.key, value)as*mutV;
357+
let val_ptr = root.borrow_mut().push(self.key, value);
358358
map.root = Some(root.forget_type());
359359
map.length = 1;
360360
val_ptr

‎library/alloc/src/ffi/c_str.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ impl CString {
408408
fn strlen(s: *const c_char) -> usize;
409409
}
410410
let len = strlen(ptr) + 1; // Including the NUL byte
411-
let slice = slice::from_raw_parts_mut(ptr, lenasusize);
411+
let slice = slice::from_raw_parts_mut(ptr, len);
412412
CString { inner: Box::from_raw(slice as *mut [c_char] as *mut [u8]) }
413413
}
414414
}

‎library/alloc/src/slice.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -511,9 +511,9 @@ impl<T> [T] {
511511
while m > 0 {
512512
// `buf.extend(buf)`:
513513
unsafe {
514-
ptr::copy_nonoverlapping(
514+
ptr::copy_nonoverlapping::<T>(
515515
buf.as_ptr(),
516-
(buf.as_mut_ptr()as*mutT).add(buf.len()),
516+
(buf.as_mut_ptr()).add(buf.len()),
517517
buf.len(),
518518
);
519519
// `buf` has capacity of `self.len() * n`.
@@ -532,9 +532,9 @@ impl<T> [T] {
532532
// `buf.extend(buf[0 .. rem_len])`:
533533
unsafe {
534534
// This is non-overlapping since `2^expn > rem`.
535-
ptr::copy_nonoverlapping(
535+
ptr::copy_nonoverlapping::<T>(
536536
buf.as_ptr(),
537-
(buf.as_mut_ptr()as*mutT).add(buf.len()),
537+
(buf.as_mut_ptr()).add(buf.len()),
538538
rem_len,
539539
);
540540
// `buf.len() + rem_len` equals to `buf.capacity()` (`= self.len() * n`).

‎library/alloc/src/task.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ fn raw_waker<W: Wake + Send + Sync + 'static>(waker: Arc<W>) -> RawWaker {
148148
unsafe fn clone_waker<W: Wake + Send + Sync + 'static>(waker: *const ()) -> RawWaker {
149149
unsafe { Arc::increment_strong_count(waker as *const W) };
150150
RawWaker::new(
151-
wakeras*const(),
151+
waker,
152152
&RawWakerVTable::new(clone_waker::<W>, wake::<W>, wake_by_ref::<W>, drop_waker::<W>),
153153
)
154154
}
@@ -320,7 +320,7 @@ fn local_raw_waker<W: LocalWake + 'static>(waker: Rc<W>) -> RawWaker {
320320
unsafe fn clone_waker<W: LocalWake + 'static>(waker: *const ()) -> RawWaker {
321321
unsafe { Rc::increment_strong_count(waker as *const W) };
322322
RawWaker::new(
323-
wakeras*const(),
323+
waker,
324324
&RawWakerVTable::new(clone_waker::<W>, wake::<W>, wake_by_ref::<W>, drop_waker::<W>),
325325
)
326326
}

‎library/std/src/sys_common/net.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ where
107107
pub fn sockaddr_to_addr(storage: &c::sockaddr_storage, len: usize) -> io::Result<SocketAddr> {
108108
match storage.ss_family as c_int {
109109
c::AF_INET => {
110-
assert!(len asusize>= mem::size_of::<c::sockaddr_in>());
110+
assert!(len >= mem::size_of::<c::sockaddr_in>());
111111
Ok(SocketAddr::V4(FromInner::from_inner(unsafe {
112112
*(storage as *const _ as *const c::sockaddr_in)
113113
})))
114114
}
115115
c::AF_INET6 => {
116-
assert!(len asusize>= mem::size_of::<c::sockaddr_in6>());
116+
assert!(len >= mem::size_of::<c::sockaddr_in6>());
117117
Ok(SocketAddr::V6(FromInner::from_inner(unsafe {
118118
*(storage as *const _ as *const c::sockaddr_in6)
119119
})))

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /