]> git.lizzy.rs Git - rust.git/commitdiff
Merge pull request #1734 from topecongiro/raw-string-literal
authorNick Cameron <nrc@ncameron.org>
Tue, 20 Jun 2017 00:29:25 +0000 (12:29 +1200)
committerGitHub <noreply@github.com>
Tue, 20 Jun 2017 00:29:25 +0000 (12:29 +1200)
Allow extending a chain after raw string literal

src/utils.rs
tests/source/chains.rs
tests/target/chains.rs

index 1be83d01babacad7726227d67aad20095ae1afb5..dc5dee6ba0d9b5501e6c99353eaf2621f77ffd57 100644 (file)
@@ -111,9 +111,10 @@ pub fn trimmed_last_line_width(s: &str) -> usize {
 #[inline]
 pub fn last_line_extendable(s: &str) -> bool {
     s.lines().last().map_or(false, |s| {
-        s.trim()
-            .chars()
-            .all(|c| c == ')' || c == ']' || c == '}' || c == '?')
+        s.ends_with("\"#") ||
+            s.trim()
+                .chars()
+                .all(|c| c == ')' || c == ']' || c == '}' || c == '?')
     })
 }
 
index 20d320ccde89d3830d37eae10186dee6fbff063b..99fe6176aa8483bbb8ef421b620434c43f576ddf 100644 (file)
@@ -152,3 +152,14 @@ fn issue_1004() {
             })
             ?;
 }
+
+fn issue1392() {
+    test_method(r#"
+        if foo {
+            a();
+        }
+        else {
+            b();
+        }
+        "#.trim());
+}
index 52e65b420e718af5f0dbb9797876763f1b20dc1b..d930f0a49badc891f00e8704bf3d0741d89e46d8 100644 (file)
@@ -169,3 +169,16 @@ fn issue_1004() {
         in_binder(f, tcx, &ty::Binder(""), Some(tap))
     })?;
 }
+
+fn issue1392() {
+    test_method(
+        r#"
+        if foo {
+            a();
+        }
+        else {
+            b();
+        }
+        "#.trim(),
+    );
+}