category | description | crev |
---|---|---|
Macros |
$crate for proc macros (prefer shim macros per review notes!) |
neutral |
$crate for proc macros
Prefer shim macros where possible (they're less brittle / more portable - thank dtolnay for the suggestion!):
#[doc(hidden)] pub use impl_crate::my_macro_impl;
#[macro_export] macro_rules! my_macro {
($($args:tt)*) => {
$crate::my_macro_impl!{$crate $($args)*}
};
}
#[proc_macro] pub fn my_macro_impl(input: TokenStream) -> TokenStream {
let mut tokens = input.into_iter();
let my_crate = tokens.next().unwrap();
...
}
Where not possible, consider hardcoding a fallback for non-cargo build environments such as Bazel instead of panicing (since proc_macro_crate relies on parsing Cargo.toml):
let my_crate = proc_macro_crate::crate_name("my-crate").unwrap_or("my_crate".to_string());
version | thoroughness | understanding | rating | Notes |
---|---|---|---|---|
0.1.4 | medium | medium | positive | Diff |
0.1.3 | medium | medium | positive | Diff |
0.1.2 | medium | medium | positive | Diff |
0.1.1 | medium | medium | positive | Diff |
0.1.0 | medium | medium | positive | Full review |
- Version bumps, typos, formatting
- Start searching
[target.*.dependencies]
too
Dropped 'static
lifetime requirements
- Added syn, proc-macro2 deps
- Sanitized "-" to "_"
Minor metadata tweaks
file | rating | notes |
---|---|---|
src/lib.rs | ✔️ | |
.cargo-ok | ✔️ | |
.gitignore | ✔️ | |
.travis.yml | ✔️ | MSRV: stable |
Cargo.toml | ✔️ | Apache-2.0/MIT |
Cargo.toml.orig | ✔️ | Apache-2.0/MIT |
README.md | ✔️ | Apache-2.0 OR MIT |
Other | Rating | Notes |
---|---|---|
unsafe | ✔️ | None |
fs | ✔️ | Opens %CARGO_MANIFEST_DIR%\Cargo.toml for read only |
io | ✔️ | Bulk parsing outsourced to toml crate |
docs | ✔️ | Straightforward |
tests | ✔️ |