Skip to content

Commit

Permalink
version: Simplify to_cfg by reusing to_feature
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 committed Nov 16, 2020
1 parent 4752f00 commit c411a37
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ pub enum Version {

impl Version {
pub fn to_cfg(self) -> String {
use self::Version::*;
match self {
Full(major, minor, 0) => format!("feature = \"v{}_{}\"", major, minor),
Full(major, minor, patch) => format!("feature = \"v{}_{}_{}\"", major, minor, patch),
Short(major) => format!("feature = \"v{}\"", major),
}
format!("feature = \"{}\"", self.to_feature())
}

pub fn to_feature(self) -> String {
Expand Down

0 comments on commit c411a37

Please sign in to comment.