]> git.lizzy.rs Git - rust.git/blobdiff - src/lists.rs
Remove unnecessary references
[rust.git] / src / lists.rs
index 117f103586706fcde8f9e7ccd5681f562ec193ce..42edc3d3d3c66cc62106739927827771e635647b 100644 (file)
@@ -114,7 +114,7 @@ pub struct ListItem {
 
 impl ListItem {
     pub fn inner_as_ref(&self) -> &str {
-        self.item.as_ref().map_or("", |s| &*s)
+        self.item.as_ref().map_or("", |s| s)
     }
 
     pub fn is_different_group(&self) -> bool {
@@ -641,7 +641,7 @@ fn next(&mut self) -> Option<Self::Item> {
             self.prev_span_end = (self.get_hi)(&item) + BytePos(comment_end as u32);
             let post_snippet = post_snippet[..comment_end].trim();
 
-            let post_snippet_trimmed = if post_snippet.starts_with(',') {
+            let post_snippet_trimmed = if post_snippet.starts_with(|c| c == ',' || c == ':') {
                 post_snippet[1..].trim_matches(white_space)
             } else if post_snippet.ends_with(',') {
                 post_snippet[..(post_snippet.len() - 1)].trim_matches(white_space)