Skip to content

Commit

Permalink
build: lint+fmt updates
Browse files Browse the repository at this point in the history
  • Loading branch information
orthecreedence committed Mar 10, 2024
1 parent 7dd4284 commit 5d3ba6b
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 27 deletions.
64 changes: 37 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: all clean release doc build run test test-panic test-st macros osx windows target/windows/stamp-cli.exe target/osx/stamp-cli
.PHONY: all clean lint fmt release doc build run test test-panic test-st macros osx windows target/windows/stamp-cli.exe target/osx/stamp-cli

# non-versioned include
VARS ?= vars.mk
Expand All @@ -11,12 +11,47 @@ all: build
run: build
cargo run $(CARGO_BUILD_ARGS)

build:
build: fmt
cargo build $(CARGO_BUILD_ARGS)

fmt:
cargo fmt

release: override CARGO_BUILD_ARGS += --release
release: build

doc:
cargo doc $(CARGO_BUILD_ARGS)

test: fmt
cargo test $(TEST) $(CARGO_BUILD_ARGS) -- --nocapture

test-release: override CARGO_BUILD_ARGS += --release
test-release: test

test-panic: override FEATURES += panic-on-error
test-panic: fmt
RUST_BACKTRACE=1 \
cargo test \
$(TEST) \
$(CARGO_BUILD_ARGS) -- \
--nocapture

test-st: fmt
cargo test $(TEST) $(CARGO_BUILD_ARGS) -- --nocapture --test-threads 1

lint:
cargo clippy $(CARGO_BUILD_ARGS) -- \
-A clippy::comparison_chain \
-A clippy::module_inception \
-A clippy::redundant_closure \
-A clippy::redundant_pattern_matching \
-A clippy::search_is_some

clean:
rm -rf target/
cargo clean

target/windows/stamp-cli.exe:
@mkdir -p $(@D)
ssh \
Expand All @@ -36,28 +71,3 @@ target/osx/stamp-cli:
osx: target/osx/stamp-cli
windows: target/windows/stamp-cli.exe

doc:
cargo doc

test-release: override CARGO_BUILD_ARGS += --release
test-release:
cargo test $(TEST) $(CARGO_BUILD_ARGS) -- --nocapture

test:
cargo test $(TEST) $(CARGO_BUILD_ARGS) -- --nocapture

test-panic: override FEATURES += panic-on-error
test-panic:
RUST_BACKTRACE=1 \
cargo test \
$(TEST) \
$(CARGO_BUILD_ARGS) -- \
--nocapture

test-st:
cargo test $(TEST) $(CARGO_BUILD_ARGS) -- --nocapture --test-threads 1

clean:
rm -rf target/
cargo clean

28 changes: 28 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#brace_style = "SameLineWhere"
#condense_wildcard_suffixes = true
#control_brace_style = "AlwaysSameLine"
#enum_discrim_align_threshold = 0
fn_call_width = 100
fn_params_layout = "Tall"
#format_macro_matchers = true
#group_imports = "Preserve"
hard_tabs = false
#imports_granularity = "Preserve"
#imports_layout = "Mixed"
#indent_style = "Block"
match_block_trailing_comma = false
max_width = 140
merge_derives = true
reorder_imports = true
reorder_modules = true
#space_after_colon = true
#space_before_colon = false
#spaces_around_ranges = false
#struct_field_align_threshold = 0
#struct_lit_single_line = true
tab_spaces = 4
#trailing_comma = "Vertical"
#trailing_semicolon = true
#type_punctuation_density = "Wide"
use_try_shorthand = true
#where_single_line = false

0 comments on commit 5d3ba6b

Please sign in to comment.