diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bbac923 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +snippets + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f16fc76 --- /dev/null +++ b/Makefile @@ -0,0 +1,38 @@ +############################################################################### +# Make file for the Easy Rust project. +# +# Author: Alexander Willner +# License : MIT +############################################################################### + +# Config +SNIPPETS = snippets +.PHONY: help + +help: ## Print help for each target + $(info Rust Makefile) + $(info =============) + $(info ) + $(info Consider to use 'cargo' for other targets.) + $(info ) + $(info Available commands:) + $(info ) + @grep '^[[:alnum:]_-]*:.* ##' $(MAKEFILE_LIST) \ + | sort | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s %s\n", $$1, $$2};' + +snippets: ## Create snippets + @type md2src >/dev/null 2>&1 || (echo "Run 'cargo install md2src' first." >&2 ; exit 1) + @mkdir -p $(SNIPPETS) + @md2src "README.md" "$(SNIPPETS)" -i "// This will fail" + +snippets-test: snippets ## Test snippets + @for snippet in $$(ls $(SNIPPETS)/*.rs); do \ + echo "File $$snippet:" ; \ + rustc --out-dir "$(SNIPPETS)" $$snippet || exit 1; \ + done + +feedback: ## Give feedback + @open https://github.com/Dhghomon/easy_rust/issues + +clean: ## Cleanup + @rm -rf "$(SNIPPETS)" \ No newline at end of file diff --git a/README.md b/README.md index b68326a..82862f8 100644 --- a/README.md +++ b/README.md @@ -130,8 +130,7 @@ fn main() { // so Rust chooses i32. Rust always // chooses i32 for integers if you don't // tell it to use a different type - println!("{}", my_number as char); - + println!("{}", my_number as char); // This will fail } ```