From f39815f942a8100bfdc371359ba098c148383a81 Mon Sep 17 00:00:00 2001 From: John Sirois Date: Fri, 9 Oct 2020 09:12:07 -0700 Subject: [PATCH 1/2] Upgrade to Rust stable 1.47.0. The changelog is here: https://blog.rust-lang.org/2020/10/08/Rust-1.47.html The most relevant change is shorter backtraces by default: https://blog.rust-lang.org/2020/10/08/Rust-1.47.html#shorter-backtraces [ci skip-build-wheels] --- rust-toolchain | 2 +- src/rust/engine/fs/src/lib.rs | 15 +++------------ src/rust/engine/graph/src/lib.rs | 6 +----- src/rust/engine/rule_graph/src/builder.rs | 12 +++++++----- 4 files changed, 12 insertions(+), 23 deletions(-) diff --git a/rust-toolchain b/rust-toolchain index 0a3db35b241..21998d3c2d9 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.46.0 +1.47.0 diff --git a/src/rust/engine/fs/src/lib.rs b/src/rust/engine/fs/src/lib.rs index dd4fd50ddd1..70ae99dbbb7 100644 --- a/src/rust/engine/fs/src/lib.rs +++ b/src/rust/engine/fs/src/lib.rs @@ -305,10 +305,7 @@ impl GitignoreStyleExcludes { } fn is_ignored(&self, stat: &Stat) -> bool { - let is_dir = match stat { - &Stat::Dir(_) => true, - _ => false, - }; + let is_dir = matches!(stat, &Stat::Dir(_)); self.is_ignored_path(stat.path(), is_dir) } @@ -357,17 +354,11 @@ impl StrictGlobMatching { } pub fn should_check_glob_matches(&self) -> bool { - match self { - &StrictGlobMatching::Ignore => false, - _ => true, - } + matches!(self, &StrictGlobMatching::Ignore) } pub fn should_throw_on_error(&self) -> bool { - match self { - &StrictGlobMatching::Error(_) => true, - _ => false, - } + matches!(self, &StrictGlobMatching::Error(_)) } } diff --git a/src/rust/engine/graph/src/lib.rs b/src/rust/engine/graph/src/lib.rs index 9624326b9d2..d7a4872e972 100644 --- a/src/rust/engine/graph/src/lib.rs +++ b/src/rust/engine/graph/src/lib.rs @@ -686,13 +686,9 @@ impl Graph { ) -> Result, N::Error> { let generations = { let inner = self.inner.lock(); - let dep_ids = inner + inner .pg .neighbors_directed(entry_id, Direction::Outgoing) - .collect::>(); - - dep_ids - .into_iter() .map(|dep_id| { let mut entry = inner .entry_for_id(dep_id) diff --git a/src/rust/engine/rule_graph/src/builder.rs b/src/rust/engine/rule_graph/src/builder.rs index ac5916c1095..b0e8e557eae 100644 --- a/src/rust/engine/rule_graph/src/builder.rs +++ b/src/rust/engine/rule_graph/src/builder.rs @@ -1015,11 +1015,13 @@ impl Builder { to_visit.extend( edge_refs .iter() - .filter(|edge_ref| match graph[edge_ref.target()].deleted_reason() { - Some(NodePrunedReason::Ambiguous) - | Some(NodePrunedReason::NoSourceOfParam) - | Some(NodePrunedReason::NoValidCombinationsOfDependencies) => true, - _ => false, + .filter(|edge_ref| { + matches!( + graph[edge_ref.target()].deleted_reason(), + Some(NodePrunedReason::Ambiguous) + | Some(NodePrunedReason::NoSourceOfParam) + | Some(NodePrunedReason::NoValidCombinationsOfDependencies) + ) }) .map(|edge_ref| edge_ref.target()), ); From f3a8f21f014333ddf6946f365c01b045f201da2b Mon Sep 17 00:00:00 2001 From: John Sirois Date: Fri, 9 Oct 2020 14:01:14 -0700 Subject: [PATCH 2/2] Fix inverted logic. # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels] --- src/rust/engine/fs/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rust/engine/fs/src/lib.rs b/src/rust/engine/fs/src/lib.rs index 70ae99dbbb7..3077b473c60 100644 --- a/src/rust/engine/fs/src/lib.rs +++ b/src/rust/engine/fs/src/lib.rs @@ -354,7 +354,7 @@ impl StrictGlobMatching { } pub fn should_check_glob_matches(&self) -> bool { - matches!(self, &StrictGlobMatching::Ignore) + !matches!(self, &StrictGlobMatching::Ignore) } pub fn should_throw_on_error(&self) -> bool {