Skip to content

Commit

Permalink
Fix warnings to unblock Clippy CI (#306)
Browse files Browse the repository at this point in the history
1. Add `doc_nightly` to list of custom cfgs

2. Remove `#[cfg(...)]`s mentioning the `time` feature

The `time` crate, alongside its corresponding `time` feature, is no
longer used by poise anymore. Code that branches whether we're using
`chrono` or `time` can simply check just for `chrono`.
  • Loading branch information
arqunis authored Sep 24, 2024
1 parent 5750259 commit c48b689
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ collector = []
# build time for peace of mind.
handle_panics = []

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(doc_nightly)"] }

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "doc_nightly"]
4 changes: 2 additions & 2 deletions src/builtins/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ pub use pretty_help::*;
mod register;
pub use register::*;

#[cfg(any(feature = "chrono", feature = "time"))]
#[cfg(feature = "chrono")]
mod paginate;
#[cfg(any(feature = "chrono", feature = "time"))]
#[cfg(feature = "chrono")]
pub use paginate::*;

use crate::{serenity::CreateAllowedMentions, serenity_prelude as serenity, CreateReply};
Expand Down
7 changes: 1 addition & 6 deletions src/structs/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ context_methods! {
}

/// Return a ID that uniquely identifies this command invocation.
#[cfg(any(feature = "chrono", feature = "time"))]
#[cfg(feature = "chrono")]
(id self)
(pub fn id(self) -> u64) {
match self {
Expand All @@ -316,11 +316,6 @@ context_methods! {

// Calculate Discord's datetime representation (millis since Discord epoch) and
// insert those bits into the ID

#[cfg(feature = "time")]
let timestamp_millis = edited_timestamp.unix_timestamp_nanos() / 1_000_000;

#[cfg(not(feature = "time"))]
let timestamp_millis = edited_timestamp.timestamp_millis();

id |= ((timestamp_millis - 1420070400000) as u64) << 22;
Expand Down

0 comments on commit c48b689

Please sign in to comment.