@@ -5,7 +5,7 @@ use clippy_config::Conf;
55use clippy_utils:: attrs:: is_doc_hidden;
66use clippy_utils:: diagnostics:: { span_lint, span_lint_and_help} ;
77use clippy_utils:: macros:: { is_panic, root_macro_call_first_node} ;
8- use clippy_utils:: source:: snippet ;
8+ use clippy_utils:: source:: snippet_opt ;
99use clippy_utils:: ty:: is_type_diagnostic_item;
1010use clippy_utils:: visitors:: Visitable ;
1111use clippy_utils:: { is_entrypoint_fn, is_trait_impl_item, method_chain_args} ;
@@ -535,11 +535,11 @@ declare_clippy_lint! {
535535}
536536
537537declare_clippy_lint ! {
538- /// Detects doc comment linebreaks that use double spaces to separate lines, instead of back-slash (\ ).
538+ /// Detects doc comment linebreaks that use double spaces to separate lines, instead of back-slash (`\` ).
539539 ///
540540 /// ### Why is this bad?
541541 /// Double spaces, when used as doc comment linebreaks, can be difficult to see, and may
542- /// accidentally be removed during automatic formatting or manual refactoring. The use of a back-slash (\ )
542+ /// accidentally be removed during automatic formatting or manual refactoring. The use of a back-slash (`\` )
543543 /// is clearer in this regard.
544544 ///
545545 /// ### Example
@@ -814,6 +814,7 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
814814 let mut code_level = 0 ;
815815 let mut blockquote_level = 0 ;
816816 let mut collected_breaks: Vec < Span > = Vec :: new ( ) ;
817+ let mut is_first_paragraph = true ;
817818
818819 let mut containers = Vec :: new ( ) ;
819820
@@ -934,7 +935,7 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
934935
935936 if let Some ( span) = fragments. span ( cx, range. clone ( ) )
936937 && !span. from_expansion ( )
937- && let snippet = snippet ( cx, span, ".." )
938+ && let Some ( snippet) = snippet_opt ( cx, span)
938939 && !snippet. trim ( ) . starts_with ( '\\' )
939940 && event == HardBreak {
940941 collected_breaks. push ( span) ;
0 commit comments