Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
env:
CARGO_TERM_COLOR: always

# Allow just one concurrent job per branch.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -36,6 +37,7 @@ jobs:
matrix:
os:
- ubuntu-latest
# Run on macOS and Windows if requested.
- ${{ contains(github.event.pull_request.labels.*.name,
'CI-run-on-macos-latest') && 'macos-latest' || '' }}
- ${{ contains(github.event.pull_request.labels.*.name,
Expand Down
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@ newtype-tools-derive = { version = "0.1.0-beta.9", path = "newtype-tools-derive"
proc-macro2 = "1.0.106"
quote = "1.0.45"
rstest = "0.26.1"
syn = { version = "2.0.117", features = ["extra-traits", "full"] }
rustversion = "1.0.22"
# To debug macro parsing:
#syn = { version = "2.0.117", features = ["extra-traits", "full"] }
syn = "2.0.117"
trybuild = "1.0.116"
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ help::
@echo " test Run cargo test."
@echo " trybuild Overwrite trybuild test results."
@echo " Misc targets:"
@echo " expand Show macro expansion for a specified test: TEST=from make expand"
@echo " fmt Run cargo fmt."
@echo " keepsorted Sort Rust derives alphabetically (cargo install keepsorted)."
@echo " publish Run the cargo publish dry run."
Expand Down Expand Up @@ -62,6 +63,9 @@ trybuild::
########################################################################
## Misc Targets

expand::
cargo expand -p newtype-tools --test ${TEST}

fmt::
cargo +nightly fmt -- --config reorder_impl_items=true,error_on_unformatted=true,error_on_line_overflow=true

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use newtype_tools::Newtype;

#[derive(Newtype)]
#[newtype(
into(Oranges, with = "|apples| Oranges((apples.0 / 2) as u32)")
into(Oranges, with = |apples| Oranges((apples.0 / 2) as u32))
)]
struct Apples(u64);
struct Oranges(u32);
Expand All @@ -65,7 +65,7 @@ use newtype_tools::Newtype;

#[derive(Debug, Newtype)]
#[newtype(
partial_eq(Oranges, with = "|apples, oranges| apples.0 == oranges.0 as u64 * 2")
partial_eq(Oranges, with = |apples, oranges| apples.0 == oranges.0 as u64 * 2)
)]
struct Apples(u64);
struct Oranges(u32);
Expand Down
Loading