Skip to content

Commit

Permalink
Automatically derive a Default impl (#180)
Browse files Browse the repository at this point in the history
Deriving Default for enums was stabilized in 1.62.0.
  • Loading branch information
davidlattimore committed Oct 30, 2023
1 parent 7baeeff commit 1318a6d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ edition = "2018"
description = "A native Rust implementation of ZeroMQ"
license = "MIT"
repository = "https://github.com/zeromq/zmq.rs"
rust-version = "1.62.0"

[features]
default = ["tokio-runtime", "all-transport"]
Expand Down
9 changes: 2 additions & 7 deletions src/codec/mechanism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@ use std::convert::TryFrom;
use std::fmt::Display;

#[allow(clippy::upper_case_acronyms)]
#[derive(Debug, Copy, Clone)]
#[derive(Debug, Copy, Clone, Default)]
pub enum ZmqMechanism {
#[default]
NULL,
PLAIN,
CURVE,
}

impl Default for ZmqMechanism {
fn default() -> Self {
ZmqMechanism::NULL
}
}

impl ZmqMechanism {
pub const fn as_str(&self) -> &'static str {
match self {
Expand Down

0 comments on commit 1318a6d

Please sign in to comment.