diff options
author | Melody Horn <melody@boringcactus.com> | 2024-11-10 16:02:48 -0700 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2024-11-10 16:02:48 -0700 |
commit | 7029372c9fada6316852915765cc0d763be3c63c (patch) | |
tree | d649d79de0b83b84637d85595fd6de2cfa38f17c /src/makefile/mod.rs | |
parent | e9080b515d86b9f39e97d4c8e1a157dfa4ba86f3 (diff) | |
download | makers-7029372c9fada6316852915765cc0d763be3c63c.tar.gz makers-7029372c9fada6316852915765cc0d763be3c63c.zip |
clippy moment
Diffstat (limited to 'src/makefile/mod.rs')
-rw-r--r-- | src/makefile/mod.rs | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/makefile/mod.rs b/src/makefile/mod.rs index 74f1f4b..62cc416 100644 --- a/src/makefile/mod.rs +++ b/src/makefile/mod.rs @@ -161,13 +161,10 @@ impl<'a> Makefile<'a> { } fn special_target_has_prereq(&self, target: &str, name: &str) -> bool { - match self.targets.get(target) { - Some(target) => { - let target = target.borrow(); - target.prerequisites.is_empty() || target.prerequisites.iter().any(|e| e == name) - } - None => false, - } + self.targets.get(target).map_or(false, |target| { + let target = target.borrow(); + target.prerequisites.is_empty() || target.prerequisites.iter().any(|e| e == name) + }) } fn infer_target( @@ -326,10 +323,9 @@ impl<'a> Makefile<'a> { self.targets.put(new_target); } - Ok(self - .targets + self.targets .get(name) - .ok_or_else(|| eyre!("Target {:?} not found!", name))?) + .ok_or_else(|| eyre!("Target {:?} not found!", name)) } pub fn update_target(&self, name: &str) -> Result<()> { @@ -376,7 +372,7 @@ impl<'a> Makefile<'a> { // chosen for the target. In the .DEFAULT rule, the $< macro // shall evaluate to the current target name. // TODO make that actually be the case (rn exists_but_inferring_anyway might fuck that up) - vec![target.prerequisites.get(0).cloned().unwrap_or_default()] + vec![target.prerequisites.first().cloned().unwrap_or_default()] } else if macro_name.starts_with('*') { // The $* macro shall evaluate to the current target name with // its suffix deleted. (GNUism: the match stem) |