aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ssr/src/lib.rs
diff options
context:
space:
mode:
authorDavid Lattimore <[email protected]>2020-07-03 04:15:00 +0100
committerDavid Lattimore <[email protected]>2020-07-03 23:56:58 +0100
commit4a8679824b9ddf950e6754231755d5d065692c47 (patch)
tree3b18c785b92b4c4619a877aaa26ec12a7302bba6 /crates/ra_ssr/src/lib.rs
parenta5ef644a16f6d187fb6b612d30f19bf4f20fc6c4 (diff)
SSR: Improve error reporting when a test fails
Diffstat (limited to 'crates/ra_ssr/src/lib.rs')
-rw-r--r--crates/ra_ssr/src/lib.rs30
1 files changed, 15 insertions, 15 deletions
diff --git a/crates/ra_ssr/src/lib.rs b/crates/ra_ssr/src/lib.rs
index d6862356d..cca4576ce 100644
--- a/crates/ra_ssr/src/lib.rs
+++ b/crates/ra_ssr/src/lib.rs
@@ -201,9 +201,8 @@ impl<'db> MatchFinder<'db> {
201 ); 201 );
202 } 202 }
203 } 203 }
204 } else {
205 self.output_debug_for_nodes_at_range(&node, range, restrict_range, out);
206 } 204 }
205 self.output_debug_for_nodes_at_range(&node, range, restrict_range, out);
207 } 206 }
208 } 207 }
209} 208}
@@ -218,25 +217,26 @@ pub struct MatchDebugInfo {
218 217
219impl std::fmt::Debug for MatchDebugInfo { 218impl std::fmt::Debug for MatchDebugInfo {
220 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 219 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
221 write!(f, "========= PATTERN ==========\n")?; 220 match &self.matched {
221 Ok(_) => writeln!(f, "Node matched")?,
222 Err(reason) => writeln!(f, "Node failed to match because: {}", reason.reason)?,
223 }
224 writeln!(
225 f,
226 "============ AST ===========\n\
227 {:#?}",
228 self.node
229 )?;
230 writeln!(f, "========= PATTERN ==========")?;
222 match &self.pattern { 231 match &self.pattern {
223 Ok(pattern) => { 232 Ok(pattern) => {
224 write!(f, "{:#?}", pattern)?; 233 writeln!(f, "{:#?}", pattern)?;
225 } 234 }
226 Err(err) => { 235 Err(err) => {
227 write!(f, "{}", err.reason)?; 236 writeln!(f, "{}", err.reason)?;
228 } 237 }
229 } 238 }
230 write!( 239 writeln!(f, "============================")?;
231 f,
232 "\n============ AST ===========\n\
233 {:#?}\n============================\n",
234 self.node
235 )?;
236 match &self.matched {
237 Ok(_) => write!(f, "Node matched")?,
238 Err(reason) => write!(f, "Node failed to match because: {}", reason.reason)?,
239 }
240 Ok(()) 240 Ok(())
241 } 241 }
242} 242}