Skip to content

Commit

Permalink
Fix compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasbb committed May 15, 2020
1 parent 1fb4552 commit 78b72f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/chrono.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ fn duration_as_secs_f64(dur: Duration) -> f64 {
(secs as f64) + (subsecs as f64) / (NANOS_PER_SEC as f64)
}

#[allow(clippy::float_cmp)]
#[test]
fn test_duration_as_secs_f64() {
assert_eq!(duration_as_secs_f64(Duration::seconds(1)), 1.);
Expand Down
13 changes: 6 additions & 7 deletions tests/chrono.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ use crate::utils::{
};
use chrono_crate::{DateTime, Duration, NaiveDateTime, Utc};
use pretty_assertions::assert_eq;
use serde::{de::DeserializeOwned, Serialize};
use serde_derive::Deserialize;
use serde::{Deserialize, Serialize};
use serde_with::{As, DurationSeconds, DurationSecondsWithFrac, Flexible, Integer, SameAs};
use std::{collections::BTreeMap, fmt::Debug, str::FromStr};
use std::{collections::BTreeMap, str::FromStr};

fn new_datetime(secs: i64, nsecs: u32) -> DateTime<Utc> {
DateTime::from_utc(NaiveDateTime::from_timestamp(secs, nsecs), Utc)
Expand Down Expand Up @@ -122,9 +121,9 @@ fn test_chrono_btree_map_naive_date_time() {
fn test_chrono_duration_seconds() {
let zero = Duration::zero();
let one_second = Duration::seconds(1);
let third_second = Duration::nanoseconds(333_333_333);
// let third_second = Duration::nanoseconds(333_333_333);
let half_second = Duration::nanoseconds(500_000_000);
let one_and_third_second = one_second + third_second;
// let one_and_third_second = one_second + third_second;
let minus_one_second = zero - one_second;
let minus_half_second = zero - half_second;

Expand Down Expand Up @@ -347,9 +346,9 @@ fn test_chrono_duration_seconds() {
fn test_chrono_duration_seconds_with_frac() {
let zero = Duration::zero();
let one_second = Duration::seconds(1);
let third_second = Duration::nanoseconds(333_333_333);
// let third_second = Duration::nanoseconds(333_333_333);
let half_second = Duration::nanoseconds(500_000_000);
let one_and_third_second = one_second + third_second;
// let one_and_third_second = one_second + third_second;
let minus_one_second = zero - one_second;
let minus_half_second = zero - half_second;

Expand Down

0 comments on commit 78b72f7

Please sign in to comment.