mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 21:05:08 +00:00
Remove dependency on ruff_rowan
(#2875)
This PR removes the dependency on `ruff_rowan` (i.e., Rome's fork of rust-analyzer's `rowan`), and in turn, trims out a lot of code in `ruff_formatter` that isn't necessary (or isn't _yet_ necessary) to power the autoformatter. We may end up pulling some of this back in -- TBD. For example, the autoformatter has its own comment representation right now, but we may eventually want to use the `comments.rs` data structures defined in `rome_formatter`.
This commit is contained in:
parent
5a84df293f
commit
f661c90bd7
61 changed files with 39 additions and 17489 deletions
|
@ -1,3 +1,5 @@
|
|||
#![allow(dead_code)]
|
||||
|
||||
use crate::prelude::*;
|
||||
use std::cell::RefCell;
|
||||
use std::marker::PhantomData;
|
||||
|
@ -5,7 +7,7 @@ use std::ops::Deref;
|
|||
|
||||
use crate::Buffer;
|
||||
|
||||
/// Utility trait that allows memorizing the output of a [Format].
|
||||
/// Utility trait that allows memorizing the output of a [`Format`].
|
||||
/// Useful to avoid re-formatting the same object twice.
|
||||
pub trait MemoizeFormat<Context> {
|
||||
/// Returns a formattable object that memoizes the result of `Format` by cloning.
|
||||
|
@ -16,7 +18,7 @@ pub trait MemoizeFormat<Context> {
|
|||
/// use std::cell::Cell;
|
||||
/// use ruff_formatter::{format, write};
|
||||
/// use ruff_formatter::prelude::*;
|
||||
/// use ruff_rowan::TextSize;
|
||||
/// use ruff_text_size::TextSize;
|
||||
///
|
||||
/// struct MyFormat {
|
||||
/// value: Cell<u64>
|
||||
|
@ -66,7 +68,7 @@ pub trait MemoizeFormat<Context> {
|
|||
|
||||
impl<T, Context> MemoizeFormat<Context> for T where T: Format<Context> {}
|
||||
|
||||
/// Memoizes the output of its inner [Format] to avoid re-formatting a potential expensive object.
|
||||
/// Memoizes the output of its inner [`Format`] to avoid re-formatting a potential expensive object.
|
||||
#[derive(Debug)]
|
||||
pub struct Memoized<F, Context> {
|
||||
inner: F,
|
||||
|
@ -98,7 +100,7 @@ where
|
|||
/// use std::cell::Cell;
|
||||
/// use ruff_formatter::{format, write};
|
||||
/// use ruff_formatter::prelude::*;
|
||||
/// use ruff_rowan::TextSize;
|
||||
/// use ruff_text_size::TextSize;
|
||||
///
|
||||
/// #[derive(Default)]
|
||||
/// struct Counter {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue