You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Meta: this isn't remotely important, logging the issue just for completeness sake.
In rust-analyzer, I am writing a test that needs to list all Rust files in rust-analyzer's repo. I think in this context using stdlib and doing something like the following should be fine:
fnlist_files_recursively(dir:&Path) -> io::Result<Vec<PathBuf>>{letmut res = Vec::new();letmut work = vec![dir.to_path_buf()];whileletSome(dir) = work.pop(){for entry in dir.read_dir()? {let entry = entry?;let file_type = entry.file_type()?;if file_type.is_dir(){
work.push(entry.path())}elseif file_type.is_file(){
res.push(entry.path())}}}Ok(res)}
However I am not sure -- there might be some pitfalls about std::fs::read_dir I am not sure about (similarly to how, eg, remove_dir_all doesn't always work on Windows). It would be helpful if walkdir (the primary alternative to "do it yourself") docs contained a section explaining when walkdir isn't actually needed.
The text was updated successfully, but these errors were encountered:
Meta: this isn't remotely important, logging the issue just for completeness sake.
In rust-analyzer, I am writing a test that needs to list all Rust files in rust-analyzer's repo. I think in this context using stdlib and doing something like the following should be fine:
However I am not sure -- there might be some pitfalls about
std::fs::read_dir
I am not sure about (similarly to how, eg,remove_dir_all
doesn't always work on Windows). It would be helpful ifwalkdir
(the primary alternative to "do it yourself") docs contained a section explaining whenwalkdir
isn't actually needed.The text was updated successfully, but these errors were encountered: