about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-01-23 11:21:46 +0000
committerbors <bors@rust-lang.org>2023-01-23 11:21:46 +0000
commite1d7a71bcc42c10c1c7a77197c19bd4f1acfbcd8 (patch)
treeb38193fdfe2ea7a6a52d37c3cb988763344d43e5
parentdaa0138e4c159d5753e41a447201b6191437276e (diff)
parent84239a14543b5a22a9662bc926c9ae033067c977 (diff)
downloadrust-e1d7a71bcc42c10c1c7a77197c19bd4f1acfbcd8.tar.gz
rust-e1d7a71bcc42c10c1c7a77197c19bd4f1acfbcd8.zip
Auto merge of #14006 - Veykril:markdown-remove-soft-break, r=Veykril
Replace soft breaks in markdown with spaces

cc https://github.com/rust-lang/rust-analyzer/pull/13988#issuecomment-1399924205
-rw-r--r--crates/ide/src/markdown_remove.rs27
1 files changed, 8 insertions, 19 deletions
diff --git a/crates/ide/src/markdown_remove.rs b/crates/ide/src/markdown_remove.rs
index 07a3fe3f02b..718868c8747 100644
--- a/crates/ide/src/markdown_remove.rs
+++ b/crates/ide/src/markdown_remove.rs
@@ -11,9 +11,8 @@ pub(crate) fn remove_markdown(markdown: &str) -> String {
     for event in parser {
         match event {
             Event::Text(text) | Event::Code(text) => out.push_str(&text),
-            Event::SoftBreak | Event::HardBreak | Event::Rule | Event::End(Tag::CodeBlock(_)) => {
-                out.push('\n')
-            }
+            Event::SoftBreak => out.push(' '),
+            Event::HardBreak | Event::Rule | Event::End(Tag::CodeBlock(_)) => out.push('\n'),
             Event::End(Tag::Paragraph) => {
                 out.push('\n');
                 out.push('\n');
@@ -111,13 +110,9 @@ book] or the [Reference].
         expect![[r#"
             A function or function pointer.
 
-            Functions are the primary way code is executed within Rust. Function blocks, usually just
-            called functions, can be defined in a variety of different places and be assigned many
-            different attributes and modifiers.
+            Functions are the primary way code is executed within Rust. Function blocks, usually just called functions, can be defined in a variety of different places and be assigned many different attributes and modifiers.
 
-            Standalone functions that just sit within a module not attached to anything else are common,
-            but most functions will end up being inside impl blocks, either on another type itself, or
-            as a trait impl for that type.
+            Standalone functions that just sit within a module not attached to anything else are common, but most functions will end up being inside impl blocks, either on another type itself, or as a trait impl for that type.
 
             fn standalone_function() {
                 // code
@@ -140,9 +135,7 @@ book] or the [Reference].
                 }
             }
 
-            In addition to presenting fixed types in the form of fn name(arg: type, ..) -> return_type,
-            functions can also declare a list of type parameters along with trait bounds that they fall
-            into.
+            In addition to presenting fixed types in the form of fn name(arg: type, ..) -> return_type, functions can also declare a list of type parameters along with trait bounds that they fall into.
 
             fn generic_function<T: Clone>(x: T) -> (T, T, T) {
                 (x.clone(), x.clone(), x.clone())
@@ -154,14 +147,10 @@ book] or the [Reference].
                 x + x + x
             }
 
-            Declaring trait bounds in the angle brackets is functionally identical to using a where
-            clause. It's up to the programmer to decide which works better in each situation, but where
-            tends to be better when things get longer than one line.
+            Declaring trait bounds in the angle brackets is functionally identical to using a where clause. It's up to the programmer to decide which works better in each situation, but where tends to be better when things get longer than one line.
 
-            Along with being made public via pub, fn can also have an extern added for use in
-            FFI.
+            Along with being made public via pub, fn can also have an extern added for use in FFI.
 
-            For more information on the various types of functions and how they're used, consult the Rust
-            book or the Reference."#]].assert_eq(&res);
+            For more information on the various types of functions and how they're used, consult the Rust book or the Reference."#]].assert_eq(&res);
     }
 }