Skip to content

Commit

Permalink
fix: use collect() instead of for loop
Browse files Browse the repository at this point in the history
  • Loading branch information
TommyCpp committed May 8, 2021
1 parent 6022ac7 commit 7228628
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions opentelemetry-otlp/tests/grpc_build.rs
Expand Up @@ -44,13 +44,17 @@ fn build_content_map() -> HashMap<PathBuf, String> {
let dict =
std::fs::read_dir("src/proto/grpcio").expect("cannot open dict of generated grpc files");

for entry in dict.into_iter().flatten() {
map.insert(
entry.path(),
std::fs::read_to_string(entry.path()).unwrap_or_else(|_| {
panic!("cannot read from file {}", entry.path().to_string_lossy())
}),
);
}
let _ = dict
.into_iter()
.flatten()
.map(|entry| {
map.insert(
entry.path(),
std::fs::read_to_string(entry.path()).unwrap_or_else(|_| {
panic!("cannot read from file {}", entry.path().to_string_lossy())
}),
);
})
.collect::<Vec<()>>();
map
}

0 comments on commit 7228628

Please sign in to comment.