mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-11 15:06:07 +00:00
fix: check the rust codes and fix them (#653)
* fix: check the rust codes and fix it * Update binary_tree_bfs.rs --------- Co-authored-by: Yudong Jin <krahets@163.com>
This commit is contained in:
@@ -52,11 +52,12 @@
|
||||
_count += 1;
|
||||
}
|
||||
|
||||
// 直接遍历列表元素
|
||||
// 直接遍历列表元素
|
||||
_count = 0;
|
||||
for _ in &list {
|
||||
for _n in &list {
|
||||
_count += 1;
|
||||
} // 或者
|
||||
}
|
||||
// 或者
|
||||
// list.iter().for_each(|_| _count += 1);
|
||||
// let _count = list.iter().fold(0, |_count, _| _count + 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user