Skip to content

Commit 94c3cbc

Browse files
bors[bot]CAD97
andauthored
Merge #77
77: Fix clippy lints r=CAD97 a=CAD97 Co-authored-by: CAD97 <cad97@cad97.com>
2 parents 61d2f3e + 48ff1a0 commit 94c3cbc

File tree

6 files changed

+43
-25
lines changed

6 files changed

+43
-25
lines changed

.github/workflows/ci.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ env:
1515

1616
jobs:
1717
cargo-test:
18-
name: Tests (beta)
18+
name: Tests
1919
if: ${{ github.event.pusher.name == 'bors[bot]' }}
2020
runs-on: ubuntu-latest
2121
steps:
2222

2323
- name: Checkout repository
2424
uses: actions/checkout@v2
2525

26-
- name: Install beta toolchain
26+
- name: Install toolchain
2727
uses: actions-rs/toolchain@v1
2828
with:
29-
toolchain: beta
29+
toolchain: 1.59.0
3030
profile: minimal
3131
override: true
3232

@@ -56,7 +56,7 @@ jobs:
5656
- name: Install arbitrary nightly toolchain
5757
uses: actions-rs/toolchain@v1
5858
with:
59-
toolchain: nightly-2020-01-01
59+
toolchain: nightly-2022-01-01
6060
profile: minimal
6161

6262
- name: Install msrv toolchain
@@ -69,7 +69,7 @@ jobs:
6969
- name: Generate minimal-versions lockfile
7070
uses: actions-rs/cargo@v1
7171
with:
72-
command: +nightly-2020-01-01
72+
command: +nightly-2022-01-01
7373
args: -Z minimal-versions generate-lockfile
7474

7575
- name: Enable caching
@@ -95,11 +95,11 @@ jobs:
9595
- name: Checkout repository
9696
uses: actions/checkout@v2
9797

98-
- name: Install beta toolchain
98+
- name: Instal toolchain
9999
uses: actions-rs/toolchain@v1
100100
with:
101101
profile: minimal
102-
toolchain: beta
102+
toolchain: 1.59.0
103103
override: true
104104
components: rustfmt
105105

@@ -121,7 +121,7 @@ jobs:
121121
uses: actions-rs/toolchain@v1
122122
with:
123123
profile: minimal
124-
toolchain: beta
124+
toolchain: 1.59.0
125125
override: true
126126
components: clippy
127127

bors.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cut-body-after = "---"
22
delete-merged-branches = true
33

44
status = [
5-
"Tests (beta)",
5+
"Tests",
66
"Tests (1.41.0)",
77
"Formatting",
88
"Lints",

crates/erasable/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ pub unsafe trait ErasablePtr {
191191
///
192192
/// This trait is automatically implemented for all sized types,
193193
/// and can be manually implemented for unsized types that know their own metadata.
194+
///
195+
/// # Safety
196+
///
197+
/// Must be implemented as described and may be relied upon by generic code.
194198
pub unsafe trait Erasable {
195199
/// Turn this erasable pointer into an erased pointer.
196200
///

crates/ptr-union/src/lib.rs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -439,18 +439,20 @@ macro_rules! impl_union {
439439
unset_any_tag(self.raw, $mask)
440440
}
441441

442-
/// Dereference the current pointer.
443-
///
444-
/// Performs a dynamic alignment check on the dereferenced pointer.
445-
pub fn try_deref<'a>(&'a self) -> Option<$Union<$(&'a $A::Target),*>>
446-
where
447-
$($A: Deref,)*
448-
$(&'a $A::Target: ErasablePtr,)*
449-
{
450-
$(if let Some(this) = self.$a() {
451-
paste::paste! { $Union::[<new_ $a>](this).ok() }
452-
} else)* {
453-
None
442+
paste::paste! {
443+
/// Dereference the current pointer.
444+
///
445+
/// Performs a dynamic alignment check on the dereferenced pointer.
446+
pub fn try_deref<'a>(&'a self) -> Option<$Union<$(&'a $A::Target),*>>
447+
where
448+
$($A: Deref,)*
449+
$(&'a $A::Target: ErasablePtr,)*
450+
{
451+
$(if let Some(this) = self.$a() {
452+
$Union::[<new_ $a>](this).ok()
453+
} else)* {
454+
None
455+
}
454456
}
455457
}
456458
}
@@ -463,9 +465,9 @@ macro_rules! impl_union {
463465
}
464466
}
465467

466-
/// Pack this loose enum into a pointer union.
467-
pub fn try_pack(self) -> Result<$Union<$($A),*>, Self> {
468-
paste::paste! {
468+
paste::paste! {
469+
/// Pack this loose enum into a pointer union.
470+
pub fn try_pack(self) -> Result<$Union<$($A),*>, Self> {
469471
match self {
470472
$($Enum::$A(this) => $Union::[<new_ $a>](this).map_err(Self::$A),)*
471473
}

crates/slice-dst/src/layout_polyfill.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use core::{
88
#[inline]
99
pub(crate) fn extend_layout(this: &Layout, next: Layout) -> Result<(Layout, usize), LayoutErr> {
1010
let new_align = cmp::max(this.align(), next.align());
11-
let pad = layout_padding_needed_for(&this, next.align());
11+
let pad = layout_padding_needed_for(this, next.align());
1212
let offset = this.size().checked_add(pad).ok_or_else(layout_err)?;
1313
let new_size = offset.checked_add(next.size()).ok_or_else(layout_err)?;
1414
let layout = Layout::from_size_align(new_size, new_align)?;

crates/slice-dst/src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ use {
158158
///
159159
/// Unless you are making a custom slice DST that needs to pack its length extremely well,
160160
/// then you should just use [`SliceWithHeader`] instead.
161+
///
162+
/// # Safety
163+
///
164+
/// Must be implemented as described and may be relied upon by generic code.
161165
pub unsafe trait SliceDst {
162166
/// Get the layout of the slice-containing type with the given slice length.
163167
fn layout_for(len: usize) -> Layout;
@@ -263,6 +267,10 @@ where
263267
///
264268
/// This is not a blanket impl due to coherence rules; if the blanket impl were present,
265269
/// it would be impossible to implement `AllocSliceDst` instead of `TryAllocSliceDst`.
270+
///
271+
/// # Safety
272+
///
273+
/// Must be implemented as described and may be relied upon by generic code.
266274
pub unsafe trait AllocSliceDst<S: ?Sized + SliceDst> {
267275
/// Create a new custom slice DST.
268276
///
@@ -297,6 +305,10 @@ macro_rules! impl_alloc_by_try_alloc {
297305

298306
/// Types that can allocate a custom slice DST within them,
299307
/// given a fallible initialization function.
308+
///
309+
/// # Safety
310+
///
311+
/// Must be implemented as described and may be relied upon by generic code.
300312
pub unsafe trait TryAllocSliceDst<S: ?Sized + SliceDst>: AllocSliceDst<S> + Sized {
301313
/// Create a new custom slice DST with a fallible initialization function.
302314
///

0 commit comments

Comments
 (0)