diff options
author | Melody Horn <melody@boringcactus.com> | 2021-03-31 13:43:46 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-03-31 13:43:46 -0600 |
commit | e1128fe55d91ca60086de45c911b4568d2eec9ee (patch) | |
tree | 14a31a8423ea848715de3ca672702104a5bc483a /src/makefile/mod.rs | |
parent | 43d2639526aa0534ef7a051cce39043095aebbab (diff) | |
download | makers-e1128fe55d91ca60086de45c911b4568d2eec9ee.tar.gz makers-e1128fe55d91ca60086de45c911b4568d2eec9ee.zip |
awolnation voice BAIL
Diffstat (limited to 'src/makefile/mod.rs')
-rw-r--r-- | src/makefile/mod.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/makefile/mod.rs b/src/makefile/mod.rs index 94a104a..1fb5935 100644 --- a/src/makefile/mod.rs +++ b/src/makefile/mod.rs @@ -7,11 +7,12 @@ use std::io::{BufRead, BufReader}; use std::path::Path; use std::rc::Rc; -use crate::args::Args; -use anyhow::Context; +use anyhow::{bail, Context}; use lazy_static::lazy_static; use regex::Regex; +use crate::args::Args; + mod command_line; mod conditional; mod functions; @@ -217,9 +218,10 @@ impl<'a> Makefile<'a> { LineType::Rule => self.read_rule(&line_tokens, line_number, &mut lines_iter)?, LineType::Macro => self.read_macro(&line_tokens, line_number)?, LineType::Unknown => { - panic!( + bail!( "error: line {}: unknown line {:?}", - line_number, line_tokens + line_number, + line_tokens ); } } @@ -511,7 +513,7 @@ impl<'a> Makefile<'a> { } let targets = self.targets.borrow(); - Ok(targets.get(name).context("Target not found!")?.clone()) + Ok(Rc::clone(targets.get(name).context("Target not found!")?)) } pub fn update_target(&self, name: &str) -> anyhow::Result<()> { |