Skip to content

Commit a2faa7d

Browse files
authored
update all dependencies (#23)
* update all dependencies Using `cargo outdated` as an helper for this task. * remove Cargo.lock from repository This is usually a bad idea for library repositories * change package name to "aoc" * fix clippy lints * the crate should actually be called "aoc-main" I forgot about that, been too long
1 parent c8d701f commit a2faa7d

File tree

6 files changed

+66
-126
lines changed

6 files changed

+66
-126
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/target
22
/input
33
.token
4+
Cargo.lock

Cargo.lock

Lines changed: 48 additions & 108 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "aoc-main"
33
description = "A macro which defines a handful main for the Advent of Code"
4-
version = "0.3.1"
4+
version = "0.4.0"
55
authors = ["Rémi Dupré <[email protected]>"]
66
repository = "https://github.com/remi-dupre/aoc"
77
license = "Apache-2.0"
@@ -14,10 +14,10 @@ edition = "2021"
1414
bench = ["criterion"]
1515

1616
[dependencies]
17-
attohttpc = { version = "0.16.0", default_features = false, features = ["tls"] }
17+
attohttpc = { version = "0.24", default_features = false, features = ["tls"] }
1818
clap = { version = "3.0.0-rc.3", default_features = false, features = ["std"] }
19-
colored = "2.0.0"
20-
dirs = "3.0.1"
19+
colored = "2"
20+
dirs = "4"
2121

2222
# Optional dependencies
23-
criterion = { version = "0.3.4", optional = true }
23+
criterion = { version = "0.4", optional = true }

src/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ pub use colored;
99
#[cfg(feature = "bench")]
1010
pub use criterion;
1111

12-
use clap::{App, Arg, ValueHint};
12+
use clap::{Arg, Command, ValueHint};
1313

14-
pub fn args(year: u16) -> App<'static> {
15-
App::new(format!("Advent of Code {}", year))
14+
pub fn args(year: u16) -> Command<'static> {
15+
Command::new(format!("Advent of Code {}", year))
1616
.author("Rémi D. <[email protected]>")
1717
.about("Main page of the event: https://adventofcode.com/")
1818
.arg(
@@ -69,13 +69,13 @@ macro_rules! base_main {
6969
let mut opt = $crate::args(YEAR).get_matches();
7070

7171
let days: Vec<_> = {
72-
if let Some(opt_days) = opt.values_of("days") {
73-
let opt_days: Vec<_> = opt_days.collect();
72+
if let Some(opt_days) = opt.get_many::<String>("days") {
73+
let opt_days: Vec<&str> = opt_days.map(|s| s.as_str()).collect();
7474
let days = parse! { extract_day {}; $( $tail )* };
7575

7676
let ignored_days: Vec<_> = opt_days
7777
.iter()
78-
.filter(|day| !days.contains(&format!("day{}", day).as_str()))
78+
.filter(|day| !days.contains(&format!("day{day}").as_str()))
7979
.copied()
8080
.collect();
8181

@@ -87,7 +87,7 @@ macro_rules! base_main {
8787
.into_iter()
8888
.filter(|day| days.contains(&format!("day{}", day).as_str()))
8989
.collect()
90-
} else if opt.is_present("all") {
90+
} else if opt.contains_id("all") {
9191
parse!(extract_day {}; $( $tail )*)
9292
.iter()
9393
.map(|s| &s[3..])
@@ -102,10 +102,10 @@ macro_rules! base_main {
102102
}
103103
};
104104

105-
if opt.is_present("bench") {
105+
if opt.contains_id("bench") {
106106
bench(days);
107107
} else {
108-
if days.len() > 1 && (opt.is_present("stdin") || opt.is_present("file")) {
108+
if days.len() > 1 && (opt.contains_id("stdin") || opt.contains_id("file")) {
109109
eprintln!(r"/!\ You are using a personalized output over several days which can");
110110
eprintln!(r" be missleading. If you only intend to run solutions for a");
111111
eprintln!(r" specific day, you can specify it by using the `-d DAY_NUM` flag.");

0 commit comments

Comments
 (0)