Skip to content

Commit 9f74fc6

Browse files
committed
Fix clippy lints
1 parent 61d2f3e commit 9f74fc6

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
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

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/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)