Skip to content

Commit 53d6e4c

Browse files
authored
A few tiny clippy-inspired nits.
1 parent 4ca2774 commit 53d6e4c

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
- name: Run checks
2222
env:
23-
CLIPPY_OPTS: --all-targets -- --allow clippy::len_without_is_empty --allow clippy::missing_safety_doc
23+
CLIPPY_OPTS: --all-targets
2424
run: |
2525
cargo fmt --check
2626
cargo clippy $CLIPPY_OPTS

src/advice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#[allow(unused_imports)]
33
use crate::{Mmap, MmapMut};
44

5-
/// Values supported by [Mmap::advise] and [MmapMut::advise] functions.
5+
/// Values supported by [`Mmap::advise`] and [`MmapMut::advise`] functions.
66
/// See [madvise()](https://man7.org/linux/man-pages/man2/madvise.2.html) map page.
77
#[repr(i32)]
88
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]

src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
//! you can use [`MmapOptions`] in order to further configure a mapping
3737
//! before you create it.
3838
39+
#![allow(clippy::len_without_is_empty, clippy::missing_safety_doc)]
40+
3941
#[cfg_attr(unix, path = "unix.rs")]
4042
#[cfg_attr(windows, path = "windows.rs")]
4143
#[cfg_attr(not(any(unix, windows)), path = "stub.rs")]
@@ -1549,7 +1551,7 @@ mod test {
15491551
.open(&path)
15501552
.unwrap();
15511553

1552-
let offset = u32::max_value() as u64 + 2;
1554+
let offset = u32::MAX as u64 + 2;
15531555
let len = 5432;
15541556
file.set_len(offset + len as u64).unwrap();
15551557

src/unix.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub struct MmapInner {
4848
impl MmapInner {
4949
/// Creates a new `MmapInner`.
5050
///
51-
/// This is a thin wrapper around the `mmap` sytem call.
51+
/// This is a thin wrapper around the `mmap` system call.
5252
fn new(
5353
len: usize,
5454
prot: libc::c_int,
@@ -59,7 +59,7 @@ impl MmapInner {
5959
let alignment = offset % page_size() as u64;
6060
let aligned_offset = offset - alignment;
6161

62-
let (map_len, map_offset) = Self::adjust_mmap_params(len as usize, alignment as usize)?;
62+
let (map_len, map_offset) = Self::adjust_mmap_params(len, alignment as usize)?;
6363

6464
unsafe {
6565
let ptr = mmap(
@@ -197,7 +197,7 @@ impl MmapInner {
197197
debug_assert!(offset < page_size(), "offset larger than page size");
198198

199199
Self {
200-
ptr: ptr.offset(offset as isize),
200+
ptr: ptr.add(offset),
201201
len,
202202
}
203203
}

0 commit comments

Comments
 (0)