cargo expand loses some of the context of macros.
Macros in Rust are hygienic, that means identifiers created inside your macro are not visible at the call site.
So for your first example the let value inside that macro is not visible after you call set_value.
See this larger example to demonstrate it a bit more:
macro_rules! set_value {
(one) => {
let value = 1.0;
};
}
fn main() {
let value = 3;
set_value!(one);
println!( "{}", value);
}
The value inside your macro is an entirely different identifier than the one in main. It just happens to have the same name.
If you want your macro to create an identifier that's visible afterwards you need to pass it in, for example: