diff --git a/src/items.rs b/src/items.rs
index a23e69d6881..01178e8e53a 100644
--- a/src/items.rs
+++ b/src/items.rs
@@ -500,7 +500,11 @@ impl<'a> FmtVisitor<'a> {
     }
 }
 
-pub fn format_impl(context: &RewriteContext, item: &ast::Item, offset: Indent) -> Option<String> {
+pub fn format_impl(context: &RewriteContext,
+                   item: &ast::Item,
+                   offset: Indent,
+                   where_span_end: Option<BytePos>)
+                   -> Option<String> {
     if let ast::ItemKind::Impl(_, _, ref generics, ref trait_ref, _, ref items) = item.node {
         let mut result = String::new();
         // First try to format the ref and type without a split at the 'for'.
@@ -527,7 +531,7 @@ pub fn format_impl(context: &RewriteContext, item: &ast::Item, offset: Indent) -
                                                              "{",
                                                              false,
                                                              last_line_width(&ref_and_type) == 1,
-                                                             None));
+                                                             where_span_end));
 
         if try_opt!(is_impl_single_line(context, &items, &result, &where_clause_str, &item)) {
             result.push_str(&where_clause_str);
diff --git a/src/visitor.rs b/src/visitor.rs
index 96327ef96a7..c40c0fcc87e 100644
--- a/src/visitor.rs
+++ b/src/visitor.rs
@@ -19,6 +19,7 @@ use strings::string_buffer::StringBuffer;
 use {Indent, Shape};
 use utils;
 use codemap::{LineRangeUtils, SpanUtils};
+use comment::FindUncommented;
 use config::Config;
 use rewrite::{Rewrite, RewriteContext};
 use comment::rewrite_comment;
@@ -249,7 +250,15 @@ impl<'a> FmtVisitor<'a> {
             }
             ast::ItemKind::Impl(..) => {
                 self.format_missing_with_indent(source!(self, item.span).lo);
-                if let Some(impl_str) = format_impl(&self.get_context(), item, self.block_indent) {
+                let snippet = self.get_context().snippet(item.span);
+                let where_span_end =
+                    snippet
+                        .find_uncommented("{")
+                        .map(|x| (BytePos(x as u32)) + source!(self, item.span).lo);
+                if let Some(impl_str) = format_impl(&self.get_context(),
+                                                    item,
+                                                    self.block_indent,
+                                                    where_span_end) {
                     self.buffer.push_str(&impl_str);
                     self.last_pos = source!(self, item.span).hi;
                 }
diff --git a/tests/target/impl.rs b/tests/target/impl.rs
index 5dde5ee7382..c51693afd22 100644
--- a/tests/target/impl.rs
+++ b/tests/target/impl.rs
@@ -5,3 +5,14 @@ impl<T> JSTraceable for SmallVec<[T; 1]> {}
 impl<K, V, NodeRef: Deref<Target = Node<K, V>>> Handle<NodeRef, handle::Edge, handle::Internal> {
     // Keep this.
 }
+
+impl<V> Test<V>
+    where V: Clone // This comment is NOT removed by formating!
+{
+    pub fn new(value: V) -> Self {
+        Test {
+            cloned_value: value.clone(),
+            value: value,
+        }
+    }
+}