aboutsummaryrefslogtreecommitdiff
path: root/src/makefile/mod.rs
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-03-31 13:43:46 -0600
committerMelody Horn <melody@boringcactus.com>2021-03-31 13:43:46 -0600
commite1128fe55d91ca60086de45c911b4568d2eec9ee (patch)
tree14a31a8423ea848715de3ca672702104a5bc483a /src/makefile/mod.rs
parent43d2639526aa0534ef7a051cce39043095aebbab (diff)
downloadmakers-e1128fe55d91ca60086de45c911b4568d2eec9ee.tar.gz
makers-e1128fe55d91ca60086de45c911b4568d2eec9ee.zip
awolnation voice BAIL
Diffstat (limited to 'src/makefile/mod.rs')
-rw-r--r--src/makefile/mod.rs12
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<()> {