Skip to content

RUST-1440 bump bson clippy version to 1.63.0 #372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 2, 2022
Merged
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
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)
Copy link
Contributor

Choose a reason for hiding this comment

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

Did chrono drop MAX_DATETIME? Or was this something clippy was complaining about?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Chrono deprecated MAX_DATETIME, yeah.

/// ```
#[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