Skip to content

Commit

Permalink
RUST-1440 bump bson clippy version to 1.63.0 (#372)
Browse files Browse the repository at this point in the history
  • Loading branch information
abr-egn committed Sep 2, 2022
1 parent 0567e3b commit bad1468
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .evergreen/check-clippy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -o errexit
. ~/.cargo/env

# Pin clippy to the latest version. This should be updated when new versions of Rust are released.
CLIPPY_VERSION=1.62.0
CLIPPY_VERSION=1.63.0

rustup install $CLIPPY_VERSION

Expand Down
9 changes: 5 additions & 4 deletions src/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ impl crate::DateTime {
/// Convert this [`DateTime`] to a [`chrono::DateTime<Utc>`].
///
/// Note: Not every BSON datetime can be represented as a [`chrono::DateTime`]. For such dates,
/// [`chrono::MIN_DATETIME`] or [`chrono::MAX_DATETIME`] will be returned, whichever is closer.
/// [`chrono::DateTime::MIN_UTC`] or [`chrono::DateTime::MAX_UTC`] will be returned, whichever
/// is closer.
///
/// ```
/// let bson_dt = bson::DateTime::now();
Expand All @@ -168,7 +169,7 @@ impl crate::DateTime {
///
/// let big = bson::DateTime::from_millis(i64::MAX);
/// let chrono_big = big.to_chrono();
/// assert_eq!(chrono_big, chrono::MAX_DATETIME)
/// assert_eq!(chrono_big, chrono::DateTime::<chrono::Utc>::MAX_UTC)
/// ```
#[cfg(feature = "chrono-0_4")]
#[cfg_attr(docsrs, doc(cfg(feature = "chrono-0_4")))]
Expand All @@ -177,9 +178,9 @@ impl crate::DateTime {
LocalResult::Single(dt) => dt,
_ => {
if self.0 < 0 {
chrono::MIN_DATETIME
chrono::DateTime::<Utc>::MIN_UTC
} else {
chrono::MAX_DATETIME
chrono::DateTime::<Utc>::MAX_UTC
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
//! The MSRV for this crate is currently 1.53.0. This will be rarely be increased, and if it ever is,
//! it will only happen in a minor or major version release.

#![allow(clippy::cognitive_complexity)]
#![allow(clippy::cognitive_complexity, clippy::derive_partial_eq_without_eq)]
#![doc(html_root_url = "https://docs.rs/bson/2.3.0")]
#![cfg_attr(docsrs, feature(doc_cfg))]

Expand Down
2 changes: 1 addition & 1 deletion src/raw/document_buf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ impl Deref for RawDocumentBuf {

impl Borrow<RawDocument> for RawDocumentBuf {
fn borrow(&self) -> &RawDocument {
&*self
self.deref()
}
}

Expand Down
14 changes: 8 additions & 6 deletions src/tests/modules/bson.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,23 +344,25 @@ fn from_external_datetime() {
}
#[cfg(feature = "chrono-0_4")]
{
let bdt = DateTime::from(chrono::MAX_DATETIME);
use chrono::Utc;

let bdt = DateTime::from(chrono::DateTime::<Utc>::MAX_UTC);
assert_eq!(
bdt.to_chrono().timestamp_millis(),
chrono::MAX_DATETIME.timestamp_millis()
chrono::DateTime::<Utc>::MAX_UTC.timestamp_millis()
);

let bdt = DateTime::from(chrono::MIN_DATETIME);
let bdt = DateTime::from(chrono::DateTime::<Utc>::MIN_UTC);
assert_eq!(
bdt.to_chrono().timestamp_millis(),
chrono::MIN_DATETIME.timestamp_millis()
chrono::DateTime::<Utc>::MIN_UTC.timestamp_millis()
);

let bdt = DateTime::MAX;
assert_eq!(bdt.to_chrono(), chrono::MAX_DATETIME);
assert_eq!(bdt.to_chrono(), chrono::DateTime::<Utc>::MAX_UTC);

let bdt = DateTime::MIN;
assert_eq!(bdt.to_chrono(), chrono::MIN_DATETIME);
assert_eq!(bdt.to_chrono(), chrono::DateTime::<Utc>::MIN_UTC);
}
}

Expand Down

0 comments on commit bad1468

Please sign in to comment.