about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorYukio Siraichi <yukio.siraichi@gmail.com>2018-03-14 06:41:05 -0300
committerYukio Siraichi <yukio.siraichi@gmail.com>2018-03-18 20:46:27 -0300
commitf41dc775a3ae1f002c24fdff6b2f7c4b68ceca66 (patch)
tree2f762331360e4592f73f3aa36ad3ea7f76cb0c81 /src
parent97b66d2987522d28bb69994e8908a5bb789bff37 (diff)
downloadrust-f41dc775a3ae1f002c24fdff6b2f7c4b68ceca66.tar.gz
rust-f41dc775a3ae1f002c24fdff6b2f7c4b68ceca66.zip
Keeping code formatting.
Suggesting snippet without changing the original formatting of the code.
Diffstat (limited to 'src')
-rw-r--r--src/librustc/traits/error_reporting.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs
index 31c8cb25c52..1bbd24de6ae 100644
--- a/src/librustc/traits/error_reporting.rs
+++ b/src/librustc/traits/error_reporting.rs
@@ -914,11 +914,16 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
                                                          new_trait_ref.to_predicate());
 
                     if selcx.evaluate_obligation(&new_obligation) {
-                        let remove_refs = refs_remaining + 1;
+                        let mut remove_refs = refs_remaining + 1;
 
                         let suggest_snippet = snippet.chars()
-                            .filter(|c| !c.is_whitespace())
-                            .skip(remove_refs)
+                            .skip_while(|c| c.is_whitespace() || {
+                                if *c == '&' && remove_refs > 0 {
+                                    true
+                                } else {
+                                    false
+                                }
+                            })
                             .collect::<String>();
 
                         err.span_suggestion(span,