Skip to content

Commit f9b3183

Browse files
committed
Auto merge of #230 - cole-miller:clippy-ptr-as-ptr, r=Amanieu
Apply suggestions from `clippy::ptr_as_ptr` This is a new pedantic lint that triggers on pointer casts with `as` that don't change mutability. It was preventing #229 from passing CI.
2 parents def8aba + 5fa1701 commit f9b3183

File tree

6 files changed

+13
-10
lines changed

6 files changed

+13
-10
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ matrix:
3333
- name: "x86_64-unknown-linux-gnu (stable)"
3434
rust: stable
3535
env: TARGET=x86_64-unknown-linux-gnu
36-
- name: "x86_64-unknown-linux-gnu (Rust 1.36.0)"
37-
rust: 1.36.0
36+
- name: "x86_64-unknown-linux-gnu (Rust 1.49.0)"
37+
rust: 1.49.0
3838
env: TARGET=x86_64-unknown-linux-gnu
3939
- name: "i686-unknown-linux-gnu"
4040
env: TARGET=i686-unknown-linux-gnu CROSS=1

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
## Changed
11+
- The minimum Rust version has been bumped to 1.49.0. (#230)
12+
1013
## [v0.10.0] - 2021-01-16
1114

1215
## Changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ hashbrown
44
[![Build Status](https://travis-ci.com/rust-lang/hashbrown.svg?branch=master)](https://travis-ci.com/rust-lang/hashbrown)
55
[![Crates.io](https://img.shields.io/crates/v/hashbrown.svg)](https://crates.io/crates/hashbrown)
66
[![Documentation](https://docs.rs/hashbrown/badge.svg)](https://docs.rs/hashbrown)
7-
[![Rust](https://img.shields.io/badge/rust-1.36.0%2B-blue.svg?maxAge=3600)](https://github.com/rust-lang/hashbrown)
7+
[![Rust](https://img.shields.io/badge/rust-1.49.0%2B-blue.svg?maxAge=3600)](https://github.com/rust-lang/hashbrown)
88

99
This crate is a Rust port of Google's high-performance [SwissTable] hash
1010
map, adapted to make it a drop-in replacement for Rust's standard `HashMap`

src/raw/generic.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl Group {
6767
#[inline]
6868
#[allow(clippy::cast_ptr_alignment)] // unaligned load
6969
pub unsafe fn load(ptr: *const u8) -> Self {
70-
Group(ptr::read_unaligned(ptr as *const _))
70+
Group(ptr::read_unaligned(ptr.cast()))
7171
}
7272

7373
/// Loads a group of bytes starting at the given address, which must be
@@ -77,7 +77,7 @@ impl Group {
7777
pub unsafe fn load_aligned(ptr: *const u8) -> Self {
7878
// FIXME: use align_offset once it stabilizes
7979
debug_assert_eq!(ptr as usize & (mem::align_of::<Self>() - 1), 0);
80-
Group(ptr::read(ptr as *const _))
80+
Group(ptr::read(ptr.cast()))
8181
}
8282

8383
/// Stores the group of bytes to the given address, which must be
@@ -87,7 +87,7 @@ impl Group {
8787
pub unsafe fn store_aligned(self, ptr: *mut u8) {
8888
// FIXME: use align_offset once it stabilizes
8989
debug_assert_eq!(ptr as usize & (mem::align_of::<Self>() - 1), 0);
90-
ptr::write(ptr as *mut _, self.0);
90+
ptr::write(ptr.cast(), self.0);
9191
}
9292

9393
/// Returns a `BitMask` indicating all bytes in the group which *may*

src/raw/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
530530
/// Returns pointer to one past last element of data table.
531531
#[cfg_attr(feature = "inline-more", inline)]
532532
pub unsafe fn data_end(&self) -> NonNull<T> {
533-
NonNull::new_unchecked(self.ctrl.as_ptr() as *mut T)
533+
NonNull::new_unchecked(self.ctrl.as_ptr().cast())
534534
}
535535

536536
/// Returns pointer to start of data table.

src/raw/sse2.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl Group {
4646
#[inline]
4747
#[allow(clippy::cast_ptr_alignment)] // unaligned load
4848
pub unsafe fn load(ptr: *const u8) -> Self {
49-
Group(x86::_mm_loadu_si128(ptr as *const _))
49+
Group(x86::_mm_loadu_si128(ptr.cast()))
5050
}
5151

5252
/// Loads a group of bytes starting at the given address, which must be
@@ -56,7 +56,7 @@ impl Group {
5656
pub unsafe fn load_aligned(ptr: *const u8) -> Self {
5757
// FIXME: use align_offset once it stabilizes
5858
debug_assert_eq!(ptr as usize & (mem::align_of::<Self>() - 1), 0);
59-
Group(x86::_mm_load_si128(ptr as *const _))
59+
Group(x86::_mm_load_si128(ptr.cast()))
6060
}
6161

6262
/// Stores the group of bytes to the given address, which must be
@@ -66,7 +66,7 @@ impl Group {
6666
pub unsafe fn store_aligned(self, ptr: *mut u8) {
6767
// FIXME: use align_offset once it stabilizes
6868
debug_assert_eq!(ptr as usize & (mem::align_of::<Self>() - 1), 0);
69-
x86::_mm_store_si128(ptr as *mut _, self.0);
69+
x86::_mm_store_si128(ptr.cast(), self.0);
7070
}
7171

7272
/// Returns a `BitMask` indicating all bytes in the group which have

0 commit comments

Comments
 (0)