Skip to content

Commit

Permalink
Minor changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
koutheir committed Dec 17, 2024
1 parent 1a0a309 commit c0daac3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
18 changes: 10 additions & 8 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@

/*! Error reporting. */

use alloc::sync::Arc;
use core::fmt;
use std::io;
use std::os::raw::c_int;
use std::sync::{Arc, Mutex};
use std::{fmt, io};
use std::sync::Mutex;

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

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

/// Casting an integer caused data loss.
#[non_exhaustive]
IntegerCast(std::num::TryFromIntError),
IntegerCast(core::num::TryFromIntError),
}

/// Call stack back trace where the `Error` object was created.
Expand Down Expand Up @@ -113,8 +115,8 @@ impl fmt::Display for Error {
}
}

impl std::error::Error for Error {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
impl core::error::Error for Error {
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
match &self.0.kind {
// Errors that are self-descriptive.
ErrorKind::TooManyVMPages => None,
Expand Down Expand Up @@ -142,8 +144,8 @@ impl From<ErrorKind> for Error {
}

/// Wrap another error into an instance of `Error`.
impl From<std::num::TryFromIntError> for Error {
fn from(err: std::num::TryFromIntError) -> Self {
impl From<core::num::TryFromIntError> for Error {
fn from(err: core::num::TryFromIntError) -> Self {
Self::from(ErrorKind::IntegerCast(err))
}
}
Expand Down
15 changes: 10 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#![doc = include_str!("../README.md")]
#![doc(html_root_url = "https://docs.rs/process_vm_io/1.0.11")]

#![warn(
unsafe_op_in_unsafe_fn,
missing_docs,
Expand All @@ -23,21 +22,27 @@
unused_import_braces,
unused_labels,
variant_size_differences,
unused_qualifications
unused_qualifications,
clippy::alloc_instead_of_core,
clippy::std_instead_of_core,
clippy::std_instead_of_alloc
)]
#![allow(clippy::upper_case_acronyms)]

mod errors;
#[cfg(test)]
mod tests;

extern crate alloc;

pub use errors::*;

use std::convert::TryFrom;
use std::ffi::c_void;
use core::convert::TryFrom;
use core::ffi::c_void;
use core::{cmp, slice};
use std::io::{IoSlice, IoSliceMut, Read, Seek, SeekFrom, Write};
use std::os::raw::c_ulong;
use std::{cmp, io, panic, slice};
use std::{io, panic};

use lazy_static::lazy_static;
use smallvec::SmallVec;
Expand Down

0 comments on commit c0daac3

Please sign in to comment.