Skip to content

Commit c0e3878

Browse files
committed
Merge pull request #81 from MicahChalmer/fix-issue-80
Remove unnecessary code with call to undefined function
2 parents 102ad5f + 88ff62a commit c0e3878

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

rust-mode-tests.el

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2168,6 +2168,35 @@ type Foo<T> where T: Copy = Box<T>;
21682168
'((10 11))
21692169
'(7 9))))
21702170

2171+
2172+
(ert-deftest font-lock-extend-region-in-string ()
2173+
2174+
(with-temp-buffer
2175+
(rust-mode)
2176+
(insert "
2177+
fn foo() {
2178+
let x = r\"
2179+
Fontification needs to include this whole string or none of it.
2180+
\"
2181+
}")
2182+
(font-lock-fontify-buffer)
2183+
(let ((font-lock-beg 13)
2184+
(font-lock-end 42))
2185+
(rust-font-lock-extend-region)
2186+
(should (<= font-lock-beg 13))
2187+
(should (>= font-lock-end 106))
2188+
)
2189+
(let ((font-lock-beg 42)
2190+
(font-lock-end 108))
2191+
(rust-font-lock-extend-region)
2192+
(should (<= font-lock-beg 25))
2193+
(should (>= font-lock-end 108)))
2194+
(let ((font-lock-beg 1)
2195+
(font-lock-end 12))
2196+
(rust-font-lock-extend-region)
2197+
(should (<= font-lock-beg 1))
2198+
(should (>= font-lock-end 12)))))
2199+
21712200
;; If electric-pair-mode is available, load it and run the tests that use it. If not,
21722201
;; no error--the tests will be skipped.
21732202
(require 'elec-pair nil t)

rust-mode.el

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -459,14 +459,6 @@
459459
(goto-char (nth 8 end-ppss))
460460
(ignore-errors (forward-sexp))
461461
(setq font-lock-end (max font-lock-end (point)))))
462-
463-
;; If we have the beginning of a raw string in the region, make sure we have the end of
464-
;; it.
465-
(when (or beg-in-str end-in-str)
466-
(save-excursion
467-
(goto-char font-lock-beg)
468-
(while (and (< (point) font-lock-end) (ignore-errors (rust-look-for-raw-string (buffer-end 1)))))
469-
(setq font-lock-end (max font-lock-end (point)))))
470462
)))
471463

472464
(or (/= font-lock-beg orig-beg)

0 commit comments

Comments
 (0)