Skip to content

Commit

Permalink
Replace rustpython_ast with rustpython_parser::ast (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Feb 15, 2023
1 parent 51d04ad commit b219d5c
Show file tree
Hide file tree
Showing 10 changed files with 144 additions and 254 deletions.
136 changes: 15 additions & 121 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions crates/ruff_fmt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ once_cell = "1.17.0"
rome_formatter = { path = "../../../tools/crates/rome_formatter" }
rome_text_size = { path = "../../../tools/crates/rome_text_size" }
rustc-hash = "1.1.0"
rustpython-ast = { git = "https://github.com/RustPython/RustPython.git", rev = "4f38cb68e4a97aeea9eb19673803a0bd5f655383" }
rustpython-common = { git = "https://github.com/RustPython/RustPython.git", rev = "4f38cb68e4a97aeea9eb19673803a0bd5f655383" }
rustpython-parser = { features = ["lalrpop"], git = "https://github.com/RustPython/RustPython.git", rev = "4f38cb68e4a97aeea9eb19673803a0bd5f655383" }
rustpython-common = { workspace = true }
rustpython-parser = { workspace = true }
test-case = { version = "2.2.2" }
2 changes: 1 addition & 1 deletion crates/ruff_fmt/src/core/locator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::rc::Rc;

use once_cell::unsync::OnceCell;
use rustpython_ast::Location;
use rustpython_parser::ast::Location;

use crate::core::types::Range;

Expand Down
2 changes: 1 addition & 1 deletion crates/ruff_fmt/src/core/rustpython_helpers.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rustpython_ast::{Mod, Suite};
use rustpython_parser::ast::{Mod, Suite};
use rustpython_parser::error::ParseError;
use rustpython_parser::lexer::LexResult;
use rustpython_parser::mode::Mode;
Expand Down
10 changes: 5 additions & 5 deletions crates/ruff_fmt/src/core/types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::ops::Deref;

use rustpython_ast::Location;
use rustpython_parser::ast::Location;

use crate::cst::{Expr, Located, Stmt};

Expand Down Expand Up @@ -63,14 +63,14 @@ impl<'a> From<&RefEquality<'a, Expr>> for &'a Expr {
}
}

impl<'a> From<&RefEquality<'a, rustpython_ast::Stmt>> for &'a rustpython_ast::Stmt {
fn from(r: &RefEquality<'a, rustpython_ast::Stmt>) -> Self {
impl<'a> From<&RefEquality<'a, rustpython_parser::ast::Stmt>> for &'a rustpython_parser::ast::Stmt {
fn from(r: &RefEquality<'a, rustpython_parser::ast::Stmt>) -> Self {
r.0
}
}

impl<'a> From<&RefEquality<'a, rustpython_ast::Expr>> for &'a rustpython_ast::Expr {
fn from(r: &RefEquality<'a, rustpython_ast::Expr>) -> Self {
impl<'a> From<&RefEquality<'a, rustpython_parser::ast::Expr>> for &'a rustpython_parser::ast::Expr {
fn from(r: &RefEquality<'a, rustpython_parser::ast::Expr>) -> Self {
r.0
}
}
2 changes: 1 addition & 1 deletion crates/ruff_fmt/src/core/visitor.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rustpython_ast::Constant;
use rustpython_parser::ast::Constant;

use crate::cst::{
Alias, Arg, Arguments, Boolop, Cmpop, Comprehension, Excepthandler, ExcepthandlerKind, Expr,
Expand Down
Loading

0 comments on commit b219d5c

Please sign in to comment.