diff options
Diffstat (limited to 'src/makefile')
| -rw-r--r-- | src/makefile/mod.rs | 14 | 
1 files changed, 7 insertions, 7 deletions
| diff --git a/src/makefile/mod.rs b/src/makefile/mod.rs index d55238e..dae742f 100644 --- a/src/makefile/mod.rs +++ b/src/makefile/mod.rs @@ -209,17 +209,17 @@ enum MacroSource {      Builtin,  } -pub struct Makefile { +pub struct Makefile<'a> {      inference_rules: Vec<InferenceRule>,      macros: HashMap<String, (MacroSource, TokenString)>,      targets: RefCell<HashMap<String, Rc<RefCell<Target>>>>,      pub first_non_special_target: Option<String>, -    args: Args, +    args: &'a Args,      // TODO borrow warnings from Python version  } -impl Makefile { -    pub fn new(args: Args) -> Makefile { +impl<'a> Makefile<'a> { +    pub fn new(args: &'a Args) -> Self {          let mut inference_rules = vec![];          let mut macros = HashMap::new();          let mut targets = HashMap::new(); @@ -264,7 +264,7 @@ impl Makefile {          }      } -    pub fn and_read_file(&mut self, path: impl AsRef<Path>) -> &mut Makefile { +    pub fn and_read_file(&mut self, path: impl AsRef<Path>) -> &mut Self {          let file = File::open(path);          // TODO handle errors          let file = file.expect("couldn't open makefile!"); @@ -272,7 +272,7 @@ impl Makefile {          self.and_read(file_reader)      } -    pub fn and_read(&mut self, source: impl BufRead) -> &mut Makefile { +    pub fn and_read(&mut self, source: impl BufRead) -> &mut Self {          let mut lines_iter = source.lines().enumerate().peekable();          while let Some((line_number, line)) = lines_iter.next() {              // TODO handle I/O errors at all @@ -754,7 +754,7 @@ impl Makefile {      }  } -impl fmt::Display for Makefile { +impl fmt::Display for Makefile<'_> {      fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {          let header = |f: &mut fmt::Formatter, t: &str| {              writeln!(f, "{}\n{:=^width$}", t, "", width = t.len()) |