-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Experiment with the Rust programming language for 2019
It's about time I give Rust a whirl.
- Loading branch information
Showing
6 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[net] | ||
offline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Cargo.lock | ||
target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "aoc-2019" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
MAKEFLAGS += --warn-undefined-variables | ||
SHELL := bash | ||
.SHELLFLAGS := -eu -o pipefail -c | ||
.DEFAULT_GOAL := all | ||
.DELETE_ON_ERROR: | ||
.SUFFIXES: | ||
|
||
CARGO ?= cargo | ||
PROFILE ?= release | ||
|
||
ext := .rs | ||
srcdir := src/bin | ||
srcs := $(wildcard $(srcdir)/puzzle_*$(ext)) | ||
answers := $(subst puzzle,answer,$(patsubst %$(ext),%.txt, $(notdir $(srcs)))) | ||
|
||
include $(CURDIR)/../mk-common/common.mk | ||
|
||
answer_%.txt: $(srcdir)/puzzle_%$(ext) input_%.txt | ||
$(CARGO) run --profile $(PROFILE) --bin $(basename $(notdir $<)) < $(filter-out $<, $^) | tee $@ | ||
|
||
.PHONY: lint | ||
lint: lint-code lint-format | ||
|
||
.PHONY: lint-code | ||
lint-code: | ||
$(CARGO) clippy | ||
|
||
.PHONY: lint-format | ||
lint-format: | ||
$(CARGO) fmt --check | ||
|
||
.PHONY: format | ||
format: | ||
$(CARGO) clippy --fix --allow-dirty | ||
$(CARGO) fmt | ||
|
||
.PHONY: distclean | ||
distclean: clean | ||
$(CARGO) clean | ||
$(RM) Cargo.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fn main() { | ||
println!("Hello, World!"); | ||
} |