From 2a4819ca195a85bf4b388c423f262ae6ff8d0418 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 8 May 2021 19:57:18 +0300 Subject: Disable more incremental --- Cargo.toml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 1f97a1dc5..cf3013c08 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,10 @@ members = ["xtask/", "lib/*", "crates/*"] [profile.dev] +# We do want incremental builds, but they are broken at the moment :( +# https://github.com/rust-lang/rust/issues/85003#issuecomment-833796289 +incremental = false + # Disabling debug info speeds up builds a bunch, # and we don't rely on it for debugging that much. debug = 0 @@ -21,6 +25,9 @@ miniz_oxide.opt-level = 3 incremental = false debug = 0 # Set this to 1 or 2 to get more useful backtraces in debugger. +[profile.test] +incremental = false + [patch.'crates-io'] # rowan = { path = "../rowan" } -- cgit v1.2.3 From 880ddddfe6937c11059e9673050ea8c4ed40ff5b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 8 May 2021 19:54:03 +0300 Subject: dead code --- crates/syntax/src/algo.rs | 122 +--------------------------------------------- 1 file changed, 1 insertion(+), 121 deletions(-) diff --git a/crates/syntax/src/algo.rs b/crates/syntax/src/algo.rs index ba263be0d..3f9b84ab9 100644 --- a/crates/syntax/src/algo.rs +++ b/crates/syntax/src/algo.rs @@ -1,10 +1,6 @@ //! FIXME: write short doc here -use std::{ - fmt, - hash::BuildHasherDefault, - ops::{self, RangeInclusive}, -}; +use std::{fmt, hash::BuildHasherDefault, ops::RangeInclusive}; use indexmap::IndexMap; use itertools::Itertools; @@ -358,107 +354,11 @@ impl fmt::Debug for SyntaxRewriter<'_> { } impl SyntaxRewriter<'_> { - pub fn delete>(&mut self, what: &T) { - let what = what.clone().into(); - let replacement = Replacement::Delete; - self.replacements.insert(what, replacement); - } - pub fn insert_before, U: Clone + Into>( - &mut self, - before: &T, - what: &U, - ) { - let before = before.clone().into(); - let pos = match before.prev_sibling_or_token() { - Some(sibling) => InsertPos::After(sibling), - None => match before.parent() { - Some(parent) => InsertPos::FirstChildOf(parent), - None => return, - }, - }; - self.insertions.entry(pos).or_insert_with(Vec::new).push(what.clone().into()); - } - pub fn insert_after, U: Clone + Into>( - &mut self, - after: &T, - what: &U, - ) { - self.insertions - .entry(InsertPos::After(after.clone().into())) - .or_insert_with(Vec::new) - .push(what.clone().into()); - } - pub fn insert_as_first_child, U: Clone + Into>( - &mut self, - parent: &T, - what: &U, - ) { - self.insertions - .entry(InsertPos::FirstChildOf(parent.clone().into())) - .or_insert_with(Vec::new) - .push(what.clone().into()); - } - pub fn insert_many_before< - T: Clone + Into, - U: IntoIterator, - >( - &mut self, - before: &T, - what: U, - ) { - let before = before.clone().into(); - let pos = match before.prev_sibling_or_token() { - Some(sibling) => InsertPos::After(sibling), - None => match before.parent() { - Some(parent) => InsertPos::FirstChildOf(parent), - None => return, - }, - }; - self.insertions.entry(pos).or_insert_with(Vec::new).extend(what); - } - pub fn insert_many_after< - T: Clone + Into, - U: IntoIterator, - >( - &mut self, - after: &T, - what: U, - ) { - self.insertions - .entry(InsertPos::After(after.clone().into())) - .or_insert_with(Vec::new) - .extend(what); - } - pub fn insert_many_as_first_children< - T: Clone + Into, - U: IntoIterator, - >( - &mut self, - parent: &T, - what: U, - ) { - self.insertions - .entry(InsertPos::FirstChildOf(parent.clone().into())) - .or_insert_with(Vec::new) - .extend(what) - } pub fn replace>(&mut self, what: &T, with: &T) { let what = what.clone().into(); let replacement = Replacement::Single(with.clone().into()); self.replacements.insert(what, replacement); } - pub fn replace_with_many>( - &mut self, - what: &T, - with: Vec, - ) { - let what = what.clone().into(); - let replacement = Replacement::Many(with); - self.replacements.insert(what, replacement); - } - pub fn replace_ast(&mut self, what: &T, with: &T) { - self.replace(what.syntax(), with.syntax()) - } pub fn rewrite(&self, node: &SyntaxNode) -> SyntaxNode { let _p = profile::span("rewrite"); @@ -534,10 +434,6 @@ impl SyntaxRewriter<'_> { if let Some(replacement) = self.replacement(&element) { match replacement { Replacement::Single(element) => acc.push(element_to_green(element)), - Replacement::Many(replacements) => { - acc.extend(replacements.into_iter().map(element_to_green)) - } - Replacement::Delete => (), }; } else { match element { @@ -560,25 +456,9 @@ fn element_to_green(element: SyntaxElement) -> NodeOrToken { - fn add_assign(&mut self, rhs: SyntaxRewriter) { - self.replacements.extend(rhs.replacements); - for (pos, insertions) in rhs.insertions.into_iter() { - match self.insertions.entry(pos) { - indexmap::map::Entry::Occupied(mut occupied) => { - occupied.get_mut().extend(insertions) - } - indexmap::map::Entry::Vacant(vacant) => drop(vacant.insert(insertions)), - } - } - } -} - #[derive(Clone, Debug)] enum Replacement { - Delete, Single(SyntaxElement), - Many(Vec), } fn with_children( -- cgit v1.2.3