]> git.lizzy.rs Git - rust.git/commitdiff
Use trim_tries to extract post comment over simple trim_matches
authorSeiichi Uchida <seuchida@gmail.com>
Fri, 31 Aug 2018 09:16:50 +0000 (18:16 +0900)
committerSeiichi Uchida <seuchida@gmail.com>
Fri, 31 Aug 2018 09:20:28 +0000 (18:20 +0900)
src/chains.rs

index d93995c94845aa6821f2d4d1c2bc2009253367a1..f73f57a19a6ab6bb833e4de7dc430132621467e8 100644 (file)
@@ -288,9 +288,9 @@ fn handle_post_comment(
                 return;
             }
             // HACK: Treat `?`s as separators.
-            let trimmed_snippet = post_comment_snippet.trim_matches('?');
-            let comment_end = get_comment_end(trimmed_snippet, "?", "", false);
-            let maybe_post_comment = extract_post_comment(trimmed_snippet, comment_end, "?")
+            let trimmed_snippet = trim_tries(post_comment_snippet);
+            let comment_end = get_comment_end(&trimmed_snippet, "?", "", false);
+            let maybe_post_comment = extract_post_comment(&trimmed_snippet, comment_end, "?")
                 .and_then(|comment| {
                     if comment.is_empty() {
                         None