That's not necessarily abuse; it may be quite appropriate to explicitly limit something's lifetime.
let var: Vec<u32>; // this one is immutable, will be initialized later
{
let mut var_; // mutable
… // initialize var_ with some mutating code
var = var_; // now move var_ to var, initializing the latter
} let var = {
let mut var = ...
var
};
that is, you can assign the result of the block directly. That way you don't need two variables with the _ name as the second. let var = {
let mut var_ = Vec::new();
var_.push(1u32);
var_
}; let var: Vec<u32> = {
let mut var_;
…
var_
};
Or, better still: let mut var: Vec<u32>;
…
let var = var;