Skip to content

Commit c0daac3

Browse files
committed
Minor changes.
1 parent 1a0a309 commit c0daac3

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

src/errors.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66

77
/*! Error reporting. */
88

9+
use alloc::sync::Arc;
10+
use core::fmt;
11+
use std::io;
912
use std::os::raw::c_int;
10-
use std::sync::{Arc, Mutex};
11-
use std::{fmt, io};
13+
use std::sync::Mutex;
1214

1315
/// A result of a fallible operation.
14-
pub(crate) type Result<T> = std::result::Result<T, Error>;
16+
pub(crate) type Result<T> = core::result::Result<T, Error>;
1517

1618
/// Actual storage for an error.
1719
#[derive(Debug, Clone)]
@@ -34,7 +36,7 @@ pub enum ErrorKind {
3436

3537
/// Casting an integer caused data loss.
3638
#[non_exhaustive]
37-
IntegerCast(std::num::TryFromIntError),
39+
IntegerCast(core::num::TryFromIntError),
3840
}
3941

4042
/// Call stack back trace where the `Error` object was created.
@@ -113,8 +115,8 @@ impl fmt::Display for Error {
113115
}
114116
}
115117

116-
impl std::error::Error for Error {
117-
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
118+
impl core::error::Error for Error {
119+
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
118120
match &self.0.kind {
119121
// Errors that are self-descriptive.
120122
ErrorKind::TooManyVMPages => None,
@@ -142,8 +144,8 @@ impl From<ErrorKind> for Error {
142144
}
143145

144146
/// Wrap another error into an instance of `Error`.
145-
impl From<std::num::TryFromIntError> for Error {
146-
fn from(err: std::num::TryFromIntError) -> Self {
147+
impl From<core::num::TryFromIntError> for Error {
148+
fn from(err: core::num::TryFromIntError) -> Self {
147149
Self::from(ErrorKind::IntegerCast(err))
148150
}
149151
}

src/lib.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#![doc = include_str!("../README.md")]
1010
#![doc(html_root_url = "https://docs.rs/process_vm_io/1.0.11")]
11-
1211
#![warn(
1312
unsafe_op_in_unsafe_fn,
1413
missing_docs,
@@ -23,21 +22,27 @@
2322
unused_import_braces,
2423
unused_labels,
2524
variant_size_differences,
26-
unused_qualifications
25+
unused_qualifications,
26+
clippy::alloc_instead_of_core,
27+
clippy::std_instead_of_core,
28+
clippy::std_instead_of_alloc
2729
)]
2830
#![allow(clippy::upper_case_acronyms)]
2931

3032
mod errors;
3133
#[cfg(test)]
3234
mod tests;
3335

36+
extern crate alloc;
37+
3438
pub use errors::*;
3539

36-
use std::convert::TryFrom;
37-
use std::ffi::c_void;
40+
use core::convert::TryFrom;
41+
use core::ffi::c_void;
42+
use core::{cmp, slice};
3843
use std::io::{IoSlice, IoSliceMut, Read, Seek, SeekFrom, Write};
3944
use std::os::raw::c_ulong;
40-
use std::{cmp, io, panic, slice};
45+
use std::{io, panic};
4146

4247
use lazy_static::lazy_static;
4348
use smallvec::SmallVec;

0 commit comments

Comments
 (0)