diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-09-22 21:48:41 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-09-22 21:48:41 +0100 |
commit | efcbca95595d31bb4c2c6782530d5a7a64a4191f (patch) | |
tree | 43dfe5d4ddec13ba9eb9bd42862b58a82103d48f /crates | |
parent | 6cc3559daa4358d0ac5d9cac23311544cdf67461 (diff) | |
parent | 43da23401dad3d708b91e61003e8503a61f57c14 (diff) |
Merge #1896
1896: remove obsolete TOOD r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_mbe/src/lib.rs | 9 | ||||
-rw-r--r-- | crates/ra_mbe/src/parser.rs | 1 | ||||
-rw-r--r-- | crates/ra_tools/tests/cli.rs | 2 |
3 files changed, 9 insertions, 3 deletions
diff --git a/crates/ra_mbe/src/lib.rs b/crates/ra_mbe/src/lib.rs index 41720df79..a0904323c 100644 --- a/crates/ra_mbe/src/lib.rs +++ b/crates/ra_mbe/src/lib.rs | |||
@@ -52,6 +52,9 @@ pub(crate) struct Rule { | |||
52 | 52 | ||
53 | impl MacroRules { | 53 | impl MacroRules { |
54 | pub fn parse(tt: &tt::Subtree) -> Result<MacroRules, ParseError> { | 54 | pub fn parse(tt: &tt::Subtree) -> Result<MacroRules, ParseError> { |
55 | // Note: this parsing can be implemented using mbe machinery itself, by | ||
56 | // matching against `$($lhs:tt => $rhs:tt);*` pattern, but implementing | ||
57 | // manually seems easier. | ||
55 | let mut src = TtIter::new(tt); | 58 | let mut src = TtIter::new(tt); |
56 | let mut rules = Vec::new(); | 59 | let mut rules = Vec::new(); |
57 | while src.len() > 0 { | 60 | while src.len() > 0 { |
@@ -64,6 +67,11 @@ impl MacroRules { | |||
64 | break; | 67 | break; |
65 | } | 68 | } |
66 | } | 69 | } |
70 | |||
71 | for rule in rules.iter() { | ||
72 | validate(&rule.lhs)?; | ||
73 | } | ||
74 | |||
67 | Ok(MacroRules { rules }) | 75 | Ok(MacroRules { rules }) |
68 | } | 76 | } |
69 | pub fn expand(&self, tt: &tt::Subtree) -> Result<tt::Subtree, ExpandError> { | 77 | pub fn expand(&self, tt: &tt::Subtree) -> Result<tt::Subtree, ExpandError> { |
@@ -77,7 +85,6 @@ impl Rule { | |||
77 | .expect_subtree() | 85 | .expect_subtree() |
78 | .map_err(|()| ParseError::Expected("expected subtree".to_string()))? | 86 | .map_err(|()| ParseError::Expected("expected subtree".to_string()))? |
79 | .clone(); | 87 | .clone(); |
80 | validate(&lhs)?; | ||
81 | lhs.delimiter = tt::Delimiter::None; | 88 | lhs.delimiter = tt::Delimiter::None; |
82 | src.expect_char('=').map_err(|()| ParseError::Expected("expected `=`".to_string()))?; | 89 | src.expect_char('=').map_err(|()| ParseError::Expected("expected `=`".to_string()))?; |
83 | src.expect_char('>').map_err(|()| ParseError::Expected("expected `>`".to_string()))?; | 90 | src.expect_char('>').map_err(|()| ParseError::Expected("expected `>`".to_string()))?; |
diff --git a/crates/ra_mbe/src/parser.rs b/crates/ra_mbe/src/parser.rs index 575f587cf..50b8011a9 100644 --- a/crates/ra_mbe/src/parser.rs +++ b/crates/ra_mbe/src/parser.rs | |||
@@ -142,7 +142,6 @@ fn is_boolean_literal(lit: &tt::Literal) -> bool { | |||
142 | } | 142 | } |
143 | } | 143 | } |
144 | 144 | ||
145 | ///TOOD: impl for slice iter | ||
146 | fn parse_repeat(src: &mut TtIter) -> Result<(Option<Separator>, RepeatKind), ExpandError> { | 145 | fn parse_repeat(src: &mut TtIter) -> Result<(Option<Separator>, RepeatKind), ExpandError> { |
147 | let mut separator = Separator::Puncts(SmallVec::new()); | 146 | let mut separator = Separator::Puncts(SmallVec::new()); |
148 | for tt in src { | 147 | for tt in src { |
diff --git a/crates/ra_tools/tests/cli.rs b/crates/ra_tools/tests/cli.rs index c672e5788..91b19c8f8 100644 --- a/crates/ra_tools/tests/cli.rs +++ b/crates/ra_tools/tests/cli.rs | |||
@@ -34,7 +34,7 @@ fn no_todo() { | |||
34 | return; | 34 | return; |
35 | } | 35 | } |
36 | let text = std::fs::read_to_string(e.path()).unwrap(); | 36 | let text = std::fs::read_to_string(e.path()).unwrap(); |
37 | if text.contains("TODO") { | 37 | if text.contains("TODO") || text.contains("TOOD") { |
38 | panic!( | 38 | panic!( |
39 | "\nTODO markers should not be commited to the master branch,\n\ | 39 | "\nTODO markers should not be commited to the master branch,\n\ |
40 | use FIXME instead\n\ | 40 | use FIXME instead\n\ |