diff --git a/Cargo.toml b/Cargo.toml index 53c7f2a..27df236 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,3 +27,7 @@ harness = false [[bench]] name = "datetime_parse" harness = false + +[lints.clippy] +std_instead_of_core = "warn" +std_instead_of_alloc = "warn" diff --git a/src/date.rs b/src/date.rs index c7e58ed..e1d0ae3 100644 --- a/src/date.rs +++ b/src/date.rs @@ -1,7 +1,8 @@ -use std::error::Error as StdError; -use std::fmt; -use std::str; -use std::time::{Duration, SystemTime, UNIX_EPOCH}; +use core::error::Error as CoreError; +use core::fmt; +use core::str; +use core::time::Duration; +use std::time::{SystemTime, UNIX_EPOCH}; #[cfg(all( target_pointer_width = "32", @@ -36,7 +37,7 @@ pub enum Error { InvalidFormat, } -impl StdError for Error {} +impl CoreError for Error {} impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/src/duration.rs b/src/duration.rs index 14e7072..458d02e 100644 --- a/src/duration.rs +++ b/src/duration.rs @@ -1,7 +1,7 @@ -use std::error::Error as StdError; -use std::fmt; -use std::str::Chars; -use std::time::Duration; +use core::error::Error as CoreError; +use core::fmt; +use core::str::Chars; +use core::time::Duration; /// Error parsing human-friendly duration #[derive(Debug, PartialEq, Clone)] @@ -48,7 +48,7 @@ pub enum Error { Empty, } -impl StdError for Error {} +impl CoreError for Error {} impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/src/wrapper.rs b/src/wrapper.rs index aebbd7b..2eec43f 100644 --- a/src/wrapper.rs +++ b/src/wrapper.rs @@ -1,7 +1,8 @@ -use std::fmt; -use std::ops::Deref; -use std::str::FromStr; -use std::time::{Duration as StdDuration, SystemTime}; +use core::fmt; +use core::ops::Deref; +use core::str::FromStr; +use core::time::Duration as StdDuration; +use std::time::SystemTime; use crate::date::{self, format_rfc3339, parse_rfc3339_weak}; use crate::duration::{self, format_duration, parse_duration};