expand_simple_defines

Function expand_simple_defines 

Source
pub(crate) fn expand_simple_defines(code: &str) -> String
Expand description

Scan for lines of the form #define IDENT IDENT (whitespace-separated single-token replacement) and substitute from → to everywhere else in the source. Operates as a single pass: defines are collected first, then applied to the rest of the source. Skips macros whose to looks like anything other than a bare identifier so we don’t accidentally inline #define K 0.5 (where the rest of the source has plain K in arithmetic context — the existing fall-through preserves it as an undefined-but-untouched identifier the user can spot in the error).