chore: move to 2018 edition

This commit is contained in:
Kevin K 2019-02-12 17:13:30 -05:00
parent df8aa6b2ee
commit 1498910971
No known key found for this signature in database
GPG key ID: 17218E4B3692F01A
14 changed files with 34 additions and 11 deletions

View file

@ -38,6 +38,7 @@ categories = ["command-line-interface"]
description = """
A simple to use, efficient, and full featured Command Line Argument Parser
"""
edition = "2018"
[badges]
travis-ci = { repository = "clap-rs/clap" }

View file

@ -0,0 +1,13 @@
pub struct Position(u64);
impl Default for Position {
fn default() -> Self {
Position(1)
}
}
impl Position {
fn new() -> Self {
Position(1)
}
}

View file

@ -1,3 +0,0 @@
pub struct Position {
index: u64
}

View file

@ -1,13 +1,14 @@
pub struct DefaultValue<'help> {
value: &'help str,
pub struct EnvDefaultValue<'help> {
key: &'help OsStr,
value: Option<OsString>
}
pub struct ConditionalDefault<'help> {
value: DefaultValue<'help>,
value: &'help str,
other_arg: Option<u64>,
other_value: Option<&'help str>,
}
pub struct DefaultValues<'help> {
defaults: Vec<ConditionalDefault<'help>>,
env: Option<EnvDefaultValue<'help>>,
}

View file

@ -1,6 +1,5 @@
pub struct Value<'help> {
defaults: Option<DefaultValues>,
name: Option<&'help str>,
filter: Filter,
occurrence: Occurrence,
requires_equals: bool,

View file

@ -0,0 +1,15 @@
use std::io;
pub struct ValueName<'help>(&'help str);
impl<'help> ValueName<'help> {
fn write_as_required<W: io::Write>(&self, w: W) -> io::Result {
write!(w, "<{}>", self.0)
}
fn write_as_optional<W: io::Write>(&self, w: W) -> io::Result {
write!(w, "[{}]", self.0)
}
fn write<W: io::Write>(&self, w: W) -> io::Result {
write!(w, "{}", self.0)
}
}

View file

@ -1,3 +0,0 @@
pub struct ValueName<'help> {
name: &'help str,
}