Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
radicle-localtime: drop must_use messages
✗ CI failure Adrian Duke committed 3 months ago
commit bfdc72f35c59a44aa57c39b4dd60bd2520b0990c
parent de89c3c33e65d26cb67ac33c5911f8ccfa495109
1 failed (1 total) View logs
1 file changed +12 -12
modified crates/radicle-localtime/src/lib.rs
@@ -49,7 +49,7 @@ impl LocalTime {
    }

    /// Construct a local time from whole seconds since Epoch.
-
    #[must_use = "constructor return new instances"]
+
    #[must_use]
    pub const fn from_secs(secs: u64) -> Self {
        Self {
            millis: secs as u128 * 1000,
@@ -57,19 +57,19 @@ impl LocalTime {
    }

    /// Construct a local time from milliseconds since Epoch.
-
    #[must_use = "constructor return new instances"]
+
    #[must_use]
    pub const fn from_millis(millis: u128) -> Self {
        Self { millis }
    }

    /// Return whole seconds since Epoch.
-
    #[must_use = "returns a value but does not modify the time"]
+
    #[must_use]
    pub fn as_secs(&self) -> u64 {
        (self.millis / 1000).try_into().unwrap()
    }

    /// Return milliseconds since Epoch.
-
    #[must_use = "returns a value but does not modify the time"]
+
    #[must_use]
    pub fn as_millis(&self) -> u64 {
        self.millis.try_into().unwrap()
    }
@@ -79,7 +79,7 @@ impl LocalTime {
    /// # Panics
    ///
    /// This function will panic if `earlier` is later than `self`.
-
    #[must_use = "returns the duration but does not modify the time"]
+
    #[must_use]
    pub fn duration_since(&self, earlier: LocalTime) -> LocalDuration {
        LocalDuration::from_millis(
            self.millis
@@ -89,7 +89,7 @@ impl LocalTime {
    }

    /// Get the difference between two times.
-
    #[must_use = "returns the difference but does not modify the time"]
+
    #[must_use]
    pub fn diff(&self, other: LocalTime) -> LocalDuration {
        if self > &other {
            self.duration_since(other)
@@ -154,37 +154,37 @@ impl LocalDuration {
    pub const MAX: LocalDuration = LocalDuration(u128::MAX);

    /// Create a new duration from whole seconds.
-
    #[must_use = "constructor return new instances"]
+
    #[must_use]
    pub const fn from_secs(secs: u64) -> Self {
        Self(secs as u128 * 1000)
    }

    /// Create a new duration from whole minutes.
-
    #[must_use = "constructor return new instances"]
+
    #[must_use]
    pub const fn from_mins(mins: u64) -> Self {
        Self::from_secs(mins * 60)
    }

    /// Construct a new duration from milliseconds.
-
    #[must_use = "constructor return new instances"]
+
    #[must_use]
    pub const fn from_millis(millis: u128) -> Self {
        Self(millis)
    }

    /// Return the number of minutes in this duration.
-
    #[must_use = "returns a value but does not modify the duration"]
+
    #[must_use]
    pub const fn as_mins(&self) -> u64 {
        self.as_secs() / 60
    }

    /// Return the number of seconds in this duration.
-
    #[must_use = "returns a value but does not modify the duration"]
+
    #[must_use]
    pub const fn as_secs(&self) -> u64 {
        (self.0 / 1000) as u64
    }

    /// Return the number of milliseconds in this duration.
-
    #[must_use = "returns a value but does not modify the duration"]
+
    #[must_use]
    pub const fn as_millis(&self) -> u128 {
        self.0
    }