diff options
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<()> { |