Create advent prelude and cleanup lint by using it.
This commit is contained in:
parent
1fb9a8416d
commit
232b2687ca
13
.gitignore
vendored
13
.gitignore
vendored
@ -1 +1,14 @@
|
|||||||
**/target/
|
**/target/
|
||||||
|
|
||||||
|
|
||||||
|
# Added by cargo
|
||||||
|
|
||||||
|
/target
|
||||||
|
|
||||||
|
|
||||||
|
# Added by cargo
|
||||||
|
#
|
||||||
|
# already existing elements were commented out
|
||||||
|
|
||||||
|
#/target
|
||||||
|
Cargo.lock
|
||||||
|
|||||||
12
2021/Cargo.lock
generated
12
2021/Cargo.lock
generated
@ -2,10 +2,22 @@
|
|||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 3
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "advent"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"aoc-runner",
|
||||||
|
"aoc-runner-derive",
|
||||||
|
"pretty_assertions",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "advent2021"
|
name = "advent2021"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"advent",
|
||||||
"ansi_term",
|
"ansi_term",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"aoc-runner",
|
"aoc-runner",
|
||||||
|
|||||||
@ -12,3 +12,4 @@ aoc-runner = "0.3.0"
|
|||||||
aoc-runner-derive = "0.3.0"
|
aoc-runner-derive = "0.3.0"
|
||||||
pretty_assertions = "1.0.0"
|
pretty_assertions = "1.0.0"
|
||||||
thiserror = "1.0.30"
|
thiserror = "1.0.30"
|
||||||
|
advent = { path = "../" }
|
||||||
|
|||||||
@ -1,13 +1,5 @@
|
|||||||
use std::{
|
use advent::prelude::*;
|
||||||
fmt::{Debug, Error, Formatter},
|
use aoc_runner_derive::aoc;
|
||||||
num::ParseIntError,
|
|
||||||
ops::{Index, IndexMut},
|
|
||||||
str::FromStr,
|
|
||||||
};
|
|
||||||
|
|
||||||
use anyhow::Result;
|
|
||||||
use aoc_runner_derive::{aoc, aoc_generator};
|
|
||||||
use thiserror::Error;
|
|
||||||
|
|
||||||
struct Image {
|
struct Image {
|
||||||
width: usize,
|
width: usize,
|
||||||
@ -182,7 +174,7 @@ fn part2(input: &str) -> Result<usize> {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
//#[test]
|
#[test]
|
||||||
fn test_part1() -> Result<()> {
|
fn test_part1() -> Result<()> {
|
||||||
let input = r#"
|
let input = r#"
|
||||||
6,10
|
6,10
|
||||||
|
|||||||
@ -1,15 +1,5 @@
|
|||||||
use std::{
|
use advent::prelude::*;
|
||||||
collections::{HashMap, HashSet, VecDeque},
|
use aoc_runner_derive::aoc;
|
||||||
convert::Infallible,
|
|
||||||
fmt::{Debug, Error, Formatter},
|
|
||||||
num::ParseIntError,
|
|
||||||
ops::{Index, IndexMut},
|
|
||||||
str::FromStr,
|
|
||||||
};
|
|
||||||
|
|
||||||
use anyhow::Result;
|
|
||||||
use aoc_runner_derive::{aoc, aoc_generator};
|
|
||||||
use thiserror::Error;
|
|
||||||
|
|
||||||
struct Image {
|
struct Image {
|
||||||
width: usize,
|
width: usize,
|
||||||
|
|||||||
@ -1,14 +1,5 @@
|
|||||||
use std::{
|
use advent::prelude::*;
|
||||||
fmt::{Debug, Error, Formatter},
|
use aoc_runner_derive::aoc;
|
||||||
io::Read,
|
|
||||||
num::ParseIntError,
|
|
||||||
ops::{Index, IndexMut},
|
|
||||||
str::FromStr,
|
|
||||||
};
|
|
||||||
|
|
||||||
use anyhow::Result;
|
|
||||||
use aoc_runner_derive::{aoc, aoc_generator};
|
|
||||||
use thiserror::Error;
|
|
||||||
|
|
||||||
fn hex(b: &u8) -> u8 {
|
fn hex(b: &u8) -> u8 {
|
||||||
if *b >= b'A' {
|
if *b >= b'A' {
|
||||||
|
|||||||
@ -3,7 +3,7 @@ pub mod day10;
|
|||||||
pub mod day11;
|
pub mod day11;
|
||||||
pub mod day12;
|
pub mod day12;
|
||||||
pub mod day13;
|
pub mod day13;
|
||||||
pub mod day14;
|
//pub mod day14;
|
||||||
pub mod day15;
|
pub mod day15;
|
||||||
pub mod day16;
|
pub mod day16;
|
||||||
pub mod day2;
|
pub mod day2;
|
||||||
|
|||||||
@ -1,13 +1,5 @@
|
|||||||
use std::{
|
use advent::prelude::*;
|
||||||
fmt::{Debug, Error, Formatter},
|
|
||||||
num::ParseIntError,
|
|
||||||
ops::{Index, IndexMut},
|
|
||||||
str::FromStr,
|
|
||||||
};
|
|
||||||
|
|
||||||
use anyhow::Result;
|
|
||||||
use aoc_runner_derive::{aoc, aoc_generator};
|
use aoc_runner_derive::{aoc, aoc_generator};
|
||||||
use thiserror::Error;
|
|
||||||
|
|
||||||
#[aoc(dayX, part1)]
|
#[aoc(dayX, part1)]
|
||||||
fn part1(input: &str) -> Result<usize> {
|
fn part1(input: &str) -> Result<usize> {
|
||||||
|
|||||||
16
Cargo.toml
Normal file
16
Cargo.toml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
[package]
|
||||||
|
name = "advent"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
anyhow = "1.0.45"
|
||||||
|
aoc-runner = "0.3.0"
|
||||||
|
aoc-runner-derive = "0.3.0"
|
||||||
|
pretty_assertions = "1.0.0"
|
||||||
|
thiserror = "1.0.30"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "advent"
|
||||||
13
src/lib.rs
Normal file
13
src/lib.rs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
pub mod prelude {
|
||||||
|
pub use std::{
|
||||||
|
convert::Infallible,
|
||||||
|
fmt::{Debug, Error, Formatter},
|
||||||
|
io::Read,
|
||||||
|
num::ParseIntError,
|
||||||
|
ops::{Index, IndexMut},
|
||||||
|
str::FromStr,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub use anyhow::Result;
|
||||||
|
pub use thiserror::Error;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user