Skip to content

Commit bbfee91

Browse files
committed
change replacement character in example, remove extraneous space from suggested change
1 parent 781e458 commit bbfee91

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

clippy_lints/src/doc/doc_comment_double_space_linebreak.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn collect_doc_replacements(attrs: &[Attribute]) -> Vec<(Span, String)> {
4242
};
4343

4444
let len = comment.len();
45-
let new_comment = format!("{pre}{} \\", comment[..len - 2].to_owned());
45+
let new_comment = format!("{pre}{}\\", &comment[..len - 2]);
4646
Some((attr.span, new_comment))
4747
} else {
4848
None

clippy_lints/src/doc/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,9 @@ declare_clippy_lint! {
431431
/// is clearer in this regard.
432432
///
433433
/// ### Example
434-
/// The two dots in this example represent a double space.
434+
/// The two replacement dots in this example represent a double space.
435435
/// ```no_run
436-
/// /// This command takes two numbers as inputs and..
436+
/// /// This command takes two numbers as inputs and··
437437
/// /// adds them together, and then returns the result.
438438
/// fn add(l: i32, r: i32) -> i32 {
439439
/// l + r

tests/ui/doc/doc_comment_double_space_linebreak.fixed

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![warn(clippy::doc_comment_double_space_linebreak)]
55
#![allow(unused)]
66

7-
//! Should warn on double space linebreaks \
7+
//! Should warn on double space linebreaks\
88
//! in file/module doc comment
99

1010
/// Should not warn on single-line doc comments
@@ -31,8 +31,8 @@ fn normal_comment() {
3131
*/
3232
}
3333

34-
/// Should warn when doc comment uses double space \
35-
/// as a line-break, even when there are multiple \
34+
/// Should warn when doc comment uses double space\
35+
/// as a line-break, even when there are multiple\
3636
/// in a row
3737
fn double_space_doc_comment() {}
3838

tests/ui/doc/doc_comment_double_space_linebreak.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: doc comments should use a back-slash (\) instead of a double space to ind
22
--> tests/ui/doc/doc_comment_double_space_linebreak.rs:7:1
33
|
44
LL | //! Should warn on double space linebreaks
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace this double space with a back-slash: `//! Should warn on double space linebreaks \`
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace this double space with a back-slash: `//! Should warn on double space linebreaks\`
66
|
77
= note: `-D clippy::doc-comment-double-space-linebreak` implied by `-D warnings`
88
= help: to override `-D warnings` add `#[allow(clippy::doc_comment_double_space_linebreak)]`
@@ -16,8 +16,8 @@ LL | | /// as a line-break, even when there are multiple
1616
|
1717
help: replace this double space with a back-slash
1818
|
19-
LL + /// Should warn when doc comment uses double space \
20-
LL + /// as a line-break, even when there are multiple \
19+
LL + /// Should warn when doc comment uses double space\
20+
LL + /// as a line-break, even when there are multiple\
2121
|
2222

2323
error: aborting due to 2 previous errors

0 commit comments

Comments
 (0)