From dae30504dd45c671cc8840b76c4265db99d3aa54 Mon Sep 17 00:00:00 2001 From: Max Willsey Date: Mon, 8 Jul 2024 13:52:22 -0700 Subject: [PATCH] Update to rust 1.79 Fixes Use newer version of rustc in CI #319 --- rust-toolchain | 2 +- src/dot.rs | 6 +++--- src/egraph.rs | 6 ++---- src/explain.rs | 8 ++++---- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/rust-toolchain b/rust-toolchain index 64d00e7d..17420a57 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.60 +1.79 diff --git a/src/dot.rs b/src/dot.rs index cefaf440..c007070b 100644 --- a/src/dot.rs +++ b/src/dot.rs @@ -87,19 +87,19 @@ where /// Renders the `Dot` to a .png file with the given filename. /// Requires a `dot` binary to be on your `$PATH`. pub fn to_png(&self, filename: impl AsRef) -> Result<()> { - self.run_dot(&["-Tpng".as_ref(), "-o".as_ref(), filename.as_ref()]) + self.run_dot(["-Tpng".as_ref(), "-o".as_ref(), filename.as_ref()]) } /// Renders the `Dot` to a .svg file with the given filename. /// Requires a `dot` binary to be on your `$PATH`. pub fn to_svg(&self, filename: impl AsRef) -> Result<()> { - self.run_dot(&["-Tsvg".as_ref(), "-o".as_ref(), filename.as_ref()]) + self.run_dot(["-Tsvg".as_ref(), "-o".as_ref(), filename.as_ref()]) } /// Renders the `Dot` to a .pdf file with the given filename. /// Requires a `dot` binary to be on your `$PATH`. pub fn to_pdf(&self, filename: impl AsRef) -> Result<()> { - self.run_dot(&["-Tpdf".as_ref(), "-o".as_ref(), filename.as_ref()]) + self.run_dot(["-Tpdf".as_ref(), "-o".as_ref(), filename.as_ref()]) } /// Invokes `dot` with the given arguments, piping this formatted diff --git a/src/egraph.rs b/src/egraph.rs index 5c15c0a2..b8688153 100644 --- a/src/egraph.rs +++ b/src/egraph.rs @@ -33,9 +33,7 @@ same e-class. You can use the `egraph[id]` syntax to get an [`EClass`] from an [`Id`], because [`EGraph`] implements -[`Index`](struct.EGraph.html#impl-Index) -and -[`IndexMut`](struct.EGraph.html#impl-IndexMut). +`Index` and `IndexMut`. Enabling the `serde-1` feature on this crate will allow you to de/serialize [`EGraph`]s using [`serde`](https://serde.rs/). @@ -765,7 +763,7 @@ pub struct SimpleLanguageMapper { impl Default for SimpleLanguageMapper { fn default() -> Self { SimpleLanguageMapper { - _phantom: PhantomData::default(), + _phantom: PhantomData, } } } diff --git a/src/explain.rs b/src/explain.rs index c42eb635..33cc0bb4 100644 --- a/src/explain.rs +++ b/src/explain.rs @@ -1,3 +1,4 @@ +#![allow(clippy::only_used_in_recursion)] use crate::Symbol; use crate::{ util::pretty_print, Analysis, EClass, ENodeOrVar, FromOp, HashMap, HashSet, Id, Language, @@ -375,11 +376,11 @@ impl Explanation { /// Check the validity of the explanation with respect to the given rules. /// This only is able to check rule applications when the rules are implement `get_pattern_ast`. - pub fn check_proof<'a, R, N: Analysis>(&mut self, rules: R) + pub fn check_proof<'a, R, N>(&mut self, rules: R) where R: IntoIterator>, L: 'a, - N: 'a, + N: Analysis + 'a, { let rules: Vec<&Rewrite> = rules.into_iter().collect(); let rule_table = Explain::make_rule_table(rules.as_slice()); @@ -1407,8 +1408,7 @@ impl<'x, L: Language> ExplainNodes<'x, L> { let mut enodes = HashSet::default(); let mut todo = vec![eclass]; - while !todo.is_empty() { - let current = todo.pop().unwrap(); + while let Some(current) = todo.pop() { if enodes.insert(current) { for neighbor in &self.explainfind[usize::from(current)].neighbors { todo.push(neighbor.next);