diff options
| author | Roee Shapira <35409124+5c077m4n@users.noreply.github.com> | 2020-11-28 21:02:05 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-28 20:02:05 +0100 |
| commit | 9ad7b8a35ea34297905ec479dbf87a35802cd8b1 (patch) | |
| tree | 6c61f8e74b72b9c8b484f39fe2173d927227bf26 /src/layout.rs | |
| parent | feat(tiles): initial WASM integration (diff) | |
| download | sl0ppij-9ad7b8a35ea34297905ec479dbf87a35802cd8b1.tar.gz sl0ppij-9ad7b8a35ea34297905ec479dbf87a35802cd8b1.tar.xz sl0ppij-9ad7b8a35ea34297905ec479dbf87a35802cd8b1.zip | |
chore(infra): added clippy check. (#65)
* Added clippy check.
* Changed step name.
* Used the suggested ci config.
* Some more clippy fixes.
* Some more clippy fixes.
* More clippy fixes.
* Removed allow annotations.
* Minor lint edit.
* More clippy fixes.
* Ran cargo fmt.
* More clippy fixes.
* More clippy fixes.
* More clippy fixes.
* More clippy fixes.
* More clippy fixes.
* More clippy fixes.
* Code review edits.
* Code review edits.
* Code review edits.
* CI update.
* CI update.
* CI update.
* Added clippy warn so wip won't fail ci.
* Cargo fmt.
Diffstat (limited to 'src/layout.rs')
| -rw-r--r-- | src/layout.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/layout.rs b/src/layout.rs index 97ff455c..6f110ee1 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -84,7 +84,7 @@ fn split_space(space_to_split: &PositionAndSize, layout: &Layout) -> Vec<Positio }; for (i, part) in layout.parts.iter().enumerate() { let part_position_and_size = split_parts.get(i).unwrap(); - if part.parts.len() > 0 { + if !part.parts.is_empty() { let mut part_positions = split_space(&part_position_and_size, part); pane_positions.append(&mut part_positions); } else { @@ -114,7 +114,7 @@ fn validate_layout_percentage_total(layout: &Layout) -> bool { } for part in layout.parts.iter() { - if part.parts.len() > 0 { + if !part.parts.is_empty() { return validate_layout_percentage_total(part); } } @@ -145,16 +145,14 @@ pub struct Layout { impl Layout { pub fn new(layout_path: PathBuf) -> Self { let mut layout_file = File::open(&layout_path) - .expect(&format!("cannot find layout {}", &layout_path.display())); + .unwrap_or_else(|_| panic!("cannot find layout {}", &layout_path.display())); let mut layout = String::new(); layout_file .read_to_string(&mut layout) - .expect(&format!("could not read layout {}", &layout_path.display())); - let layout: Layout = serde_yaml::from_str(&layout).expect(&format!( - "could not parse layout {}", - &layout_path.display() - )); + .unwrap_or_else(|_| panic!("could not read layout {}", &layout_path.display())); + let layout: Layout = serde_yaml::from_str(&layout) + .unwrap_or_else(|_| panic!("could not parse layout {}", &layout_path.display())); layout.validate(); layout |
