Thanks, @erelde. After I posted this, I changed the inner map to |x| 1 +x and got a compilation error: x can't be added to 1 because it is a Range. I thought iter/into_iter will give me elements of the Range. Still a bit confused!
The point is, vec![value] is a one-element vector containing only value. In your case, the value happens to be a range, which does not undergo any special treatment: you'll still have a single-element vector with a range as its only element. If you map over that vector, the returned iterator will yield ranges and pass them to the mapped function. There's nothing magical going on, this is how it should behave.
I don't know where you get this code from, but I'm
pretty sure no official documentation explicitly (and mistakenly) tells the reader to use vec![range] to crate a vector of indexes. That'd be (0..20).collect::<Vec<_>>().
I can understand the mistake; I wouldn’t ever write it myself, but reading the code, it took me several looks over the code to catch the mistake. Especially considering that .. appears with special meaning in slice patterns, too, I feel like it’s a natural thing to mis-interpret them to have special meaning when they don’t in vector or array expressions. I wouldn’t mind e.g. a helpful clippy lint that encouraged you to write vec![(0..20)] instead of vec![0..20] to make it more clear.