rls
rls copied to clipboard
Autocomplete std::fs::ReadDir in a loop
Hello! I've got such piece of code.
use std::path;
fn main() {
let tmp_dir_path = path::Path::new("/tmp");
let tmp_dir_read = tmp_dir_path.read_dir().unwrap();
for dir_entry in tmp_dir_read {
dir_entry.//stay here
}
}
RLS doesn't suggest fields of io::Result<DirEntry>
in a loop only. I got such issue a couple of times with other structures but I've fixed it on a ReadDir
instance. If you try to create another structure and implementer Iterator
for it so RLS works perfect with it.
Is it bug or did I miss something in configuration?
UPD: OS: ubuntu 19.10 rls 1.41.0 (b27e117 2020-01-13) rustc 1.42.0 (b8cedc004 2020-03-09)
Similar issue with vectors.
fn main() -> std::io::Result<()> {
let v = vec![vec![1, 2, 3], vec![1, 2, 3]];
for iv in v {
let s = iv;
s. // Autocomplete doesn't work
}
Ok(())
}
fn main() -> std::io::Result<()> {
let v = vec![vec![1, 2, 3], vec![1, 2, 3]];
for iv in v {
let s: Vec<i32> = iv;
s. // Autocomplete works
}
Ok(())
}