diff options
| author | Brian Mastenbrook <brian@mastenbrook.net> | 2016-04-06 11:40:15 -0500 |
|---|---|---|
| committer | Brian Mastenbrook <brian@mastenbrook.net> | 2016-04-06 11:40:15 -0500 |
| commit | 917503bf51d936ee0868a377527ff88a8a7a2ac0 (patch) | |
| tree | 758c8816b3e72d10b6f6d38408f2f0f8d4c4c31c | |
| parent | c3feac1505609fe1a11388d126957257ae5facb2 (diff) | |
| download | rust-mode-917503bf51d936ee0868a377527ff88a8a7a2ac0.tar.gz | |
Fix failing tests, and add a test for the fix.
| -rw-r--r-- | rust-mode-tests.el | 9 | ||||
| -rw-r--r-- | rust-mode.el | 7 |
2 files changed, 14 insertions, 2 deletions
diff --git a/rust-mode-tests.el b/rust-mode-tests.el index 2c0431c..de3900c 100644 --- a/rust-mode-tests.el +++ b/rust-mode-tests.el @@ -164,6 +164,15 @@ Also, the result should be the same regardless of whether the code is at the beg // // This is the second really really really really really really long paragraph" 1 89)) +(ert-deftest fill-paragraph-multi-line-style-comment () + (test-fill-paragraph + "/* This is a very very very very very very very very long string + */" + "/* This is a very very very very + * very very very very long + * string + */")) + (ert-deftest fill-paragraph-multi-line-style-inner-doc-comment () (test-fill-paragraph "/*! This is a very very very very very very very long string diff --git a/rust-mode.el b/rust-mode.el index 273a751..bb4d792 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -1058,10 +1058,13 @@ the desired identifiers), but does not match type annotations \"foo::<\"." (let ((result ;; Replace /* with same number of spaces (replace-regexp-in-string - "\\(?:/\\*+\\)" + "\\(?:/\\*+\\)[!*]?" (lambda (s) ;; We want the * to line up with the first * of the comment start - (concat (make-string (- (length s) 1) ?\x20) "*")) + (concat (make-string (- (length s) + (if (or (string-suffix-p "!" s) + (string-suffix-p "**" s)) 2 1)) + ?\x20) "*")) line-start))) ;; Make sure we've got at least one space at the end (if (not (= (aref result (- (length result) 1)) ?\x20)) |
