@@ -14,10 +14,10 @@ pub fn check(cx: &LateContext<'_>, collected_breaks: &[Span]) {
1414 cx,
1515 DOC_COMMENT_DOUBLE_SPACE_LINEBREAK ,
1616 lo_span. to ( hi_span) ,
17- "doc comments should use a back-slash ( \\ ) instead of a double space to indicate a linebreak " ,
17+ "doc comment uses two spaces for a hard line break " ,
1818 |diag| {
1919 diag. multipart_suggestion (
20- "replace this double space with a back-slash " ,
20+ "replace this double space with a backslash " ,
2121 replacements,
2222 Applicability :: MachineApplicable ,
2323 ) ;
@@ -38,59 +38,3 @@ fn collect_doc_replacements(cx: &LateContext<'_>, spans: &[Span]) -> Vec<(Span,
3838 } )
3939 . collect ( )
4040}
41-
42- /*
43- use clippy_utils::diagnostics::span_lint_and_then;
44- use rustc_ast::token::CommentKind;
45- use rustc_ast::{AttrKind, AttrStyle, Attribute};
46- use rustc_errors::Applicability;
47- use rustc_lint::LateContext;
48- use rustc_span::Span;
49-
50- use super::DOC_COMMENT_DOUBLE_SPACE_LINEBREAK;
51-
52- pub fn check(cx: &LateContext<'_>, attrs: &[Attribute]) {
53- let replacements: Vec<_> = collect_doc_replacements(attrs);
54-
55- if let Some((&(lo_span, _), &(hi_span, _))) = replacements.first().zip(replacements.last()) {
56- span_lint_and_then(
57- cx,
58- DOC_COMMENT_DOUBLE_SPACE_LINEBREAK,
59- lo_span.to(hi_span),
60- "doc comments should use a back-slash (\\) instead of a double space to indicate a linebreak",
61- |diag| {
62- diag.multipart_suggestion(
63- "replace this double space with a back-slash",
64- replacements,
65- Applicability::MachineApplicable,
66- );
67- },
68- );
69- }
70- }
71-
72- fn collect_doc_replacements(attrs: &[Attribute]) -> Vec<(Span, String)> {
73- attrs
74- .iter()
75- .filter_map(|attr| {
76- if let AttrKind::DocComment(com_kind, sym) = attr.kind
77- && !attr.span.from_expansion()
78- && com_kind == CommentKind::Line
79- && let comment = sym.as_str()
80- && comment.ends_with(" ")
81- {
82- let pre = match attr.style {
83- AttrStyle::Outer => "///",
84- AttrStyle::Inner => "//!",
85- };
86-
87- let len = comment.len();
88- let new_comment = format!("{pre}{}\\", &comment[..len - 2]);
89- Some((attr.span, new_comment))
90- } else {
91- None
92- }
93- })
94- .collect()
95- }
96- */
0 commit comments