Skip to content

Commit bcb0b52

Browse files
committed
Fix all lints
1 parent 3bd207c commit bcb0b52

File tree

8 files changed

+25
-49
lines changed

8 files changed

+25
-49
lines changed

.github/workflows/build.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ jobs:
1111
rust: [1.32.0, 1.36.0, stable]
1212
target:
1313
- { triple: x86_64-unknown-netbsd, std: true }
14-
- { triple: x86_64-sun-solaris, std: true }
1514
- { triple: wasm32-wasi, std: true }
1615
- { triple: thumbv7em-none-eabihf, std: false }
1716
exclude:
@@ -21,11 +20,6 @@ jobs:
2120
- # WASI target did not exist at the time
2221
rust: 1.32.0
2322
target: { triple: wasm32-wasi, std: true }
24-
- # Solaris target did not exist in previous rust
25-
rust: 1.32.0
26-
target: { triple: x86_64-sun-solaris, std: true }
27-
- rust: 1.36.0
28-
target: { triple: x86_64-sun-solaris, std: true }
2923

3024
steps:
3125
- name: Checkout sources

src/date.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ use crate::{
66
DeferredFormat, Duration, ParseResult, PrimitiveDateTime, Time, Weekday,
77
};
88
#[cfg(not(feature = "std"))]
9-
use alloc::{
10-
borrow::ToOwned,
11-
string::{String, ToString},
12-
};
9+
use alloc::string::{String, ToString};
1310
use const_fn::const_fn;
1411
use core::{
1512
cmp::{Ord, Ordering, PartialOrd},
@@ -972,9 +969,7 @@ impl Date {
972969
/// assert_eq!(date!(2019-01-02).lazy_format("%Y-%m-%d").to_string(), "2019-01-02");
973970
/// ```
974971
pub fn lazy_format(self, format: impl AsRef<str>) -> impl Display {
975-
DeferredFormat::new(format.as_ref())
976-
.with_date(self)
977-
.to_owned()
972+
DeferredFormat::new(format.as_ref()).with_date(self).clone()
978973
}
979974

980975
/// Attempt to parse a `Date` using the provided string.

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@
152152
clippy::inline_always,
153153
clippy::map_err_ignore,
154154
clippy::missing_errors_doc,
155+
clippy::missing_panics_doc,
155156
clippy::module_name_repetitions,
156157
clippy::must_use_candidate,
157158
clippy::redundant_pub_crate,

src/offset_date_time.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ use crate::{
66
UtcOffset, Weekday,
77
};
88
#[cfg(not(feature = "std"))]
9-
use alloc::{
10-
borrow::ToOwned,
11-
string::{String, ToString},
12-
};
9+
use alloc::string::{String, ToString};
1310
#[cfg(feature = "std")]
1411
use core::convert::From;
1512
use core::{
@@ -883,7 +880,7 @@ impl OffsetDateTime {
883880
.with_date(self.date())
884881
.with_time(self.time())
885882
.with_offset(self.offset())
886-
.to_owned()
883+
.clone()
887884
}
888885

889886
/// Attempt to parse an `OffsetDateTime` using the provided string.

src/primitive_date_time.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ use crate::{
44
Weekday,
55
};
66
#[cfg(not(feature = "std"))]
7-
use alloc::{
8-
borrow::ToOwned,
9-
string::{String, ToString},
10-
};
7+
use alloc::string::{String, ToString};
118
use const_fn::const_fn;
129
#[cfg(feature = "std")]
1310
use core::convert::From;
@@ -515,7 +512,7 @@ impl PrimitiveDateTime {
515512
DeferredFormat::new(format.as_ref())
516513
.with_date(self.date())
517514
.with_time(self.time())
518-
.to_owned()
515+
.clone()
519516
}
520517

521518
/// Attempt to parse a `PrimitiveDateTime` using the provided string.

src/time_mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ use crate::{
66
DeferredFormat, Duration, ParseResult,
77
};
88
#[cfg(not(feature = "std"))]
9-
use alloc::{
10-
borrow::ToOwned,
11-
string::{String, ToString},
12-
};
9+
use alloc::string::{String, ToString};
1310
use const_fn::const_fn;
1411
use core::{
1512
cmp::Ordering,
@@ -567,9 +564,7 @@ impl Time {
567564
/// assert_eq!(time!(0:00).lazy_format("%r").to_string(), "12:00:00 am");
568565
/// ```
569566
pub fn lazy_format(self, format: impl AsRef<str>) -> impl Display {
570-
DeferredFormat::new(format.as_ref())
571-
.with_time(self)
572-
.to_owned()
567+
DeferredFormat::new(format.as_ref()).with_time(self).clone()
573568
}
574569

575570
/// Attempt to parse a `Time` using the provided string.

src/utc_offset.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ use crate::{
66
DeferredFormat, Duration, ParseResult,
77
};
88
#[cfg(not(feature = "std"))]
9-
use alloc::{
10-
borrow::ToOwned,
11-
string::{String, ToString},
12-
};
9+
use alloc::string::{String, ToString};
1310
use core::fmt::{self, Display};
1411

1512
/// An offset from UTC.
@@ -289,7 +286,7 @@ impl UtcOffset {
289286
pub fn lazy_format(self, format: impl AsRef<str>) -> impl Display {
290287
DeferredFormat::new(format.as_ref())
291288
.with_offset(self)
292-
.to_owned()
289+
.clone()
293290
}
294291

295292
/// Attempt to parse the `UtcOffset` using the provided string.

time-macros-impl/src/lib.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,20 @@ use quote::ToTokens;
9191
use syn::parse_macro_input;
9292
use time::Time;
9393

94-
macro_rules! impl_macros {
95-
($($name:ident : $type:ty),* $(,)?) => {
96-
$(
97-
#[proc_macro_hack]
98-
#[allow(clippy::unimplemented)]
99-
pub fn $name(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
100-
parse_macro_input!(input as $type).to_token_stream().into()
101-
}
102-
)*
103-
};
94+
#[proc_macro_hack]
95+
#[allow(clippy::unimplemented)]
96+
pub fn time(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
97+
parse_macro_input!(input as Time).to_token_stream().into()
98+
}
99+
100+
#[proc_macro_hack]
101+
#[allow(clippy::unimplemented)]
102+
pub fn offset(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
103+
parse_macro_input!(input as Offset).to_token_stream().into()
104104
}
105105

106-
impl_macros! {
107-
time: Time,
108-
offset: Offset,
109-
date: Date,
106+
#[proc_macro_hack]
107+
#[allow(clippy::unimplemented)]
108+
pub fn date(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
109+
parse_macro_input!(input as Date).to_token_stream().into()
110110
}

0 commit comments

Comments
 (0)