From 036141663bd934da451461dbc47dc836c432e057 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sat, 4 May 2019 19:34:02 +0800 Subject: Quote the quoted comment --- crates/ra_mbe/src/syntax_bridge.rs | 2 +- crates/ra_mbe/src/tests.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_mbe') diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs index 63ca54cc2..73a0780da 100644 --- a/crates/ra_mbe/src/syntax_bridge.rs +++ b/crates/ra_mbe/src/syntax_bridge.rs @@ -135,7 +135,7 @@ fn doc_comment_text(comment: &ast::Comment) -> SmolStr { // Quote the string // Note that `tt::Literal` expect an escaped string - let text = format!("\"{}\"", text.escape_default()); + let text = format!("{:?}", text.escape_default().to_string()); text.into() } diff --git a/crates/ra_mbe/src/tests.rs b/crates/ra_mbe/src/tests.rs index 897f76be1..c487bbbd4 100644 --- a/crates/ra_mbe/src/tests.rs +++ b/crates/ra_mbe/src/tests.rs @@ -888,7 +888,7 @@ fn test_meta_doc_comments() { MultiLines Doc */ }"#, - "# [doc = \" Single Line Doc 1\"] # [doc = \" \\n MultiLines Doc\\n \"] fn bar () {}", + "# [doc = \" Single Line Doc 1\"] # [doc = \" \\\\n MultiLines Doc\\\\n \"] fn bar () {}", ); } -- cgit v1.2.3