#expand #macro #macro-expansion #hide #skip

macro dont-expand

Dummy macros to shadow macros to avoid expansion in cargo expand

1 unstable release

0.1.0 Oct 29, 2021

#1525 in Procedural macros

MIT license

6KB
54 lines

dont-expand

This library provides macro implementations for macros found in the rust std library. The purpose of the macros in this library is to do nothing. The macros are intended to be imported as needed to shadow the std macros. This is useful when using cargo expand to see what a macro might be doing as it will effectively hide the typical expansion of the std macros which typically just pollute the output.

Included macros are: assert, assert_eq, assert_ne, cfg, column, compile_error, concat, dbg, debug_assert, debug_assert_eq, debug_assert_ne, env, eprint, eprintln, file, format, format_args, include, include_bytes, include_str, is_x86_feature_detected, line, matches, module_path, option_env, panic, print, println, thread_local, todo, unimplemented, unreachable, vec, write, writeln

And the following derive macros: Debug, Default, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord

The following example would only show the expansion of the Default macro

use dont_expand::{Debug, Clone};

#[derive(Debug, Clone, Default)]
struct Foo;

Glob imports don't work with dont-expand as that throws an error by the compiler since they shadow the std macros.

Dependencies

~4KB