This might be because I am not well versed in the HTTP URI standards but I would expect following two pieces of code to produce the same (or basically the same) Parts instances.
1:
let mut parts = Uri::from_static("localhost:8080").into_parts();
parts.scheme = Some(Scheme::HTTPS);2:
let parts = Uri::from_static("https://localhost:8080").into_parts();However, for 2, the path_and_query is set to effectively Some("/") where as in 1 it is set to None. Which means that putting them back into a Uri, the second one passes where as the first one fails.
I think that the first one should work.