Skip to content

Commit 55f1564

Browse files
committed
remove fragments from syntax
1 parent dacbc6a commit 55f1564

20 files changed

+0
-98
lines changed

crates/syntax/src/lib.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,6 @@ impl ast::Path {
180180
}
181181
}
182182

183-
impl ast::Pat {
184-
/// Returns `text`, parsed as a pattern, but only if it has no errors.
185-
pub fn parse(text: &str) -> Result<Self, ()> {
186-
parsing::parse_text_as(text, parser::ParserEntryPoint::Pattern)
187-
}
188-
}
189-
190183
impl ast::Expr {
191184
/// Returns `text`, parsed as an expression, but only if it has no errors.
192185
pub fn parse(text: &str) -> Result<Self, ()> {

crates/syntax/src/tests.rs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,6 @@ fn validation_tests() {
5959
});
6060
}
6161

62-
#[test]
63-
fn path_parser_tests() {
64-
fragment_parser_dir_test(
65-
&["parser/fragments/path/ok"],
66-
&["parser/fragments/path/err"],
67-
crate::ast::Path::parse,
68-
);
69-
}
70-
71-
#[test]
72-
fn pattern_parser_tests() {
73-
fragment_parser_dir_test(
74-
&["parser/fragments/pattern/ok"],
75-
&["parser/fragments/pattern/err"],
76-
crate::ast::Pat::parse,
77-
);
78-
}
79-
8062
#[test]
8163
fn parser_fuzz_tests() {
8264
for (_, text) in collect_rust_files(&test_data_dir(), &["parser/fuzz-failures"]) {
@@ -136,24 +118,6 @@ fn assert_errors_are_present(errors: &[SyntaxError], path: &Path) {
136118
assert!(!errors.is_empty(), "There should be errors in the file {:?}", path.display());
137119
}
138120

139-
fn fragment_parser_dir_test<T, F>(ok_paths: &[&str], err_paths: &[&str], f: F)
140-
where
141-
T: crate::AstNode,
142-
F: Fn(&str) -> Result<T, ()>,
143-
{
144-
dir_tests(&test_data_dir(), ok_paths, "rast", |text, path| match f(text) {
145-
Ok(node) => format!("{:#?}", crate::ast::AstNode::syntax(&node)),
146-
Err(_) => panic!("Failed to parse '{:?}'", path),
147-
});
148-
dir_tests(&test_data_dir(), err_paths, "rast", |text, path| {
149-
if f(text).is_ok() {
150-
panic!("'{:?}' successfully parsed when it should have errored", path);
151-
} else {
152-
"ERROR\n".to_owned()
153-
}
154-
});
155-
}
156-
157121
/// Calls callback `f` with input code and file paths for each `.rs` file in `test_data_dir`
158122
/// subdirectories defined by `paths`.
159123
///

crates/syntax/test_data/parser/fragments/item/err/0000_extra_keyword.rast

Lines changed: 0 additions & 1 deletion
This file was deleted.

crates/syntax/test_data/parser/fragments/item/err/0000_extra_keyword.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

crates/syntax/test_data/parser/fragments/item/ok/0000_fn.rast

Lines changed: 0 additions & 13 deletions
This file was deleted.

crates/syntax/test_data/parser/fragments/item/ok/0000_fn.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

crates/syntax/test_data/parser/fragments/path/err/0000_reserved_word.rast

Lines changed: 0 additions & 1 deletion
This file was deleted.

crates/syntax/test_data/parser/fragments/path/err/0000_reserved_word.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

crates/syntax/test_data/parser/fragments/path/err/0001_expression.rast

Lines changed: 0 additions & 1 deletion
This file was deleted.

crates/syntax/test_data/parser/fragments/path/err/0001_expression.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

crates/syntax/test_data/parser/fragments/path/ok/0000_single_ident.rast

Lines changed: 0 additions & 4 deletions
This file was deleted.

crates/syntax/test_data/parser/fragments/path/ok/0000_single_ident.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

crates/syntax/test_data/parser/fragments/path/ok/0001_multipart.rast

Lines changed: 0 additions & 14 deletions
This file was deleted.

crates/syntax/test_data/parser/fragments/path/ok/0001_multipart.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

crates/syntax/test_data/parser/fragments/pattern/err/0000_reserved_word.rast

Lines changed: 0 additions & 1 deletion
This file was deleted.

crates/syntax/test_data/parser/fragments/pattern/err/0000_reserved_word.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

crates/syntax/test_data/parser/fragments/pattern/err/0001_missing_paren.rast

Lines changed: 0 additions & 1 deletion
This file was deleted.

crates/syntax/test_data/parser/fragments/pattern/err/0001_missing_paren.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

crates/syntax/test_data/parser/fragments/pattern/ok/0000_enum.rast

Lines changed: 0 additions & 10 deletions
This file was deleted.

crates/syntax/test_data/parser/fragments/pattern/ok/0000_enum.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)