Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ harness = false
[[bench]]
name = "datetime_parse"
harness = false

[lints.clippy]
std_instead_of_core = "warn"
std_instead_of_alloc = "warn"
11 changes: 6 additions & 5 deletions src/date.rs
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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 {
Expand Down
10 changes: 5 additions & 5 deletions src/duration.rs
Original file line number Diff line number Diff line change
@@ -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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest leaving this as std::error::Error as StdError in this commit, then we can make it conditional on the std feature in a subsequent PR.

use core::fmt;
use core::str::Chars;
use core::time::Duration;

/// Error parsing human-friendly duration
#[derive(Debug, PartialEq, Clone)]
Expand Down Expand Up @@ -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 {
Expand Down
9 changes: 5 additions & 4 deletions src/wrapper.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
Loading