I don’t think you can, and I think it makes sense: it would be weird for the compiler to unexpectedly generate hidden variables for you.
For all the compiler knows, the temporary variable could hold a file handle, a database transaction, a Mutex, or other side effects in their Drop implementation that would make when it’s dropped matter. Or it could just be a very large struct you might not expect to keep around until the end of the function (or even, the end of the program if that’s a main loop).
So you should be aware of it, and thus you need the temporary variable like you did even if you just immediately shadow it. But at least you know you’re holding on to it until the end of the function.
I’ll take the autotools over Gradle, that’s how much it sucks.