aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-12-07 18:48:35 +0000
committerGitHub <noreply@github.com>2020-12-07 18:48:35 +0000
commit03b886de53834168dd52b5e504a649292f129ae6 (patch)
tree8aa5589eef906e67a55ae2737ca1a6f731793f39 /crates
parent8a950dfb406a927085602af016855cfe1988aee1 (diff)
parenta1c8bdecfd408b7573357604f9c6543556f3f19a (diff)
Merge #6719
6719: Use items can also have doc comments r=matklad a=Veykril Prior to this change modules show more docs than they have cause they inherit the docs from documented use items inside of them. Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Diffstat (limited to 'crates')
-rw-r--r--crates/ide/src/folding_ranges.rs13
-rw-r--r--crates/syntax/src/ast/node_ext.rs1
-rw-r--r--crates/syntax/src/parsing/text_tree_sink.rs2
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rast18
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0110_use_path.rast12
5 files changed, 23 insertions, 23 deletions
diff --git a/crates/ide/src/folding_ranges.rs b/crates/ide/src/folding_ranges.rs
index 7523aec55..45170dd29 100644
--- a/crates/ide/src/folding_ranges.rs
+++ b/crates/ide/src/folding_ranges.rs
@@ -83,7 +83,6 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> {
83fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> { 83fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> {
84 match kind { 84 match kind {
85 COMMENT => Some(FoldKind::Comment), 85 COMMENT => Some(FoldKind::Comment),
86 USE => Some(FoldKind::Imports),
87 ARG_LIST | PARAM_LIST => Some(FoldKind::ArgList), 86 ARG_LIST | PARAM_LIST => Some(FoldKind::ArgList),
88 ASSOC_ITEM_LIST 87 ASSOC_ITEM_LIST
89 | RECORD_FIELD_LIST 88 | RECORD_FIELD_LIST
@@ -258,11 +257,11 @@ fn main() <fold block>{
258 fn test_fold_imports() { 257 fn test_fold_imports() {
259 check( 258 check(
260 r#" 259 r#"
261<fold imports>use std::<fold block>{ 260use std::<fold block>{
262 str, 261 str,
263 vec, 262 vec,
264 io as iop 263 io as iop
265}</fold>;</fold> 264}</fold>;
266 265
267fn main() <fold block>{ 266fn main() <fold block>{
268}</fold>"#, 267}</fold>"#,
@@ -306,9 +305,9 @@ use std::io as iop;</fold>
306<fold imports>use std::mem; 305<fold imports>use std::mem;
307use std::f64;</fold> 306use std::f64;</fold>
308 307
309use std::collections::HashMap; 308<fold imports>use std::collections::HashMap;
310// Some random comment 309// Some random comment
311use std::collections::VecDeque; 310use std::collections::VecDeque;</fold>
312 311
313fn main() <fold block>{ 312fn main() <fold block>{
314}</fold>"#, 313}</fold>"#,
@@ -326,10 +325,10 @@ use std::io as iop;</fold>
326<fold imports>use std::mem; 325<fold imports>use std::mem;
327use std::f64;</fold> 326use std::f64;</fold>
328 327
329<fold imports>use std::collections::<fold block>{ 328use std::collections::<fold block>{
330 HashMap, 329 HashMap,
331 VecDeque, 330 VecDeque,
332}</fold>;</fold> 331}</fold>;
333// Some random comment 332// Some random comment
334 333
335fn main() <fold block>{ 334fn main() <fold block>{
diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs
index b70b840b8..aa3a4b606 100644
--- a/crates/syntax/src/ast/node_ext.rs
+++ b/crates/syntax/src/ast/node_ext.rs
@@ -477,3 +477,4 @@ impl ast::DocCommentsOwner for ast::Const {}
477impl ast::DocCommentsOwner for ast::TypeAlias {} 477impl ast::DocCommentsOwner for ast::TypeAlias {}
478impl ast::DocCommentsOwner for ast::Impl {} 478impl ast::DocCommentsOwner for ast::Impl {}
479impl ast::DocCommentsOwner for ast::MacroCall {} 479impl ast::DocCommentsOwner for ast::MacroCall {}
480impl ast::DocCommentsOwner for ast::Use {}
diff --git a/crates/syntax/src/parsing/text_tree_sink.rs b/crates/syntax/src/parsing/text_tree_sink.rs
index 997bc5d28..49842177a 100644
--- a/crates/syntax/src/parsing/text_tree_sink.rs
+++ b/crates/syntax/src/parsing/text_tree_sink.rs
@@ -148,7 +148,7 @@ fn n_attached_trivias<'a>(
148) -> usize { 148) -> usize {
149 match kind { 149 match kind {
150 MACRO_CALL | CONST | TYPE_ALIAS | STRUCT | ENUM | VARIANT | FN | TRAIT | MODULE 150 MACRO_CALL | CONST | TYPE_ALIAS | STRUCT | ENUM | VARIANT | FN | TRAIT | MODULE
151 | RECORD_FIELD | STATIC => { 151 | RECORD_FIELD | STATIC | USE => {
152 let mut res = 0; 152 let mut res = 0;
153 let mut trivias = trivias.enumerate().peekable(); 153 let mut trivias = trivias.enumerate().peekable();
154 154
diff --git a/crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rast b/crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rast
index 1e80dd7e2..b1fb75ed1 100644
--- a/crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0002_use_tree_list.rast
@@ -49,9 +49,9 @@ SOURCE_FILE@0..249
49 R_CURLY@56..57 "}" 49 R_CURLY@56..57 "}"
50 SEMICOLON@57..58 ";" 50 SEMICOLON@57..58 ";"
51 WHITESPACE@58..59 " " 51 WHITESPACE@58..59 " "
52 COMMENT@59..97 "// Rust 2018 (with a ..." 52 USE@59..121
53 WHITESPACE@97..98 "\n" 53 COMMENT@59..97 "// Rust 2018 (with a ..."
54 USE@98..121 54 WHITESPACE@97..98 "\n"
55 USE_KW@98..101 "use" 55 USE_KW@98..101 "use"
56 WHITESPACE@101..102 " " 56 WHITESPACE@101..102 " "
57 USE_TREE@102..120 57 USE_TREE@102..120
@@ -75,9 +75,9 @@ SOURCE_FILE@0..249
75 R_CURLY@119..120 "}" 75 R_CURLY@119..120 "}"
76 SEMICOLON@120..121 ";" 76 SEMICOLON@120..121 ";"
77 WHITESPACE@121..122 " " 77 WHITESPACE@121..122 " "
78 COMMENT@122..134 "// Rust 2015" 78 USE@122..166
79 WHITESPACE@134..135 "\n" 79 COMMENT@122..134 "// Rust 2015"
80 USE@135..166 80 WHITESPACE@134..135 "\n"
81 USE_KW@135..138 "use" 81 USE_KW@135..138 "use"
82 WHITESPACE@138..139 " " 82 WHITESPACE@138..139 " "
83 USE_TREE@139..165 83 USE_TREE@139..165
@@ -102,9 +102,9 @@ SOURCE_FILE@0..249
102 R_CURLY@164..165 "}" 102 R_CURLY@164..165 "}"
103 SEMICOLON@165..166 ";" 103 SEMICOLON@165..166 ";"
104 WHITESPACE@166..167 " " 104 WHITESPACE@166..167 " "
105 COMMENT@167..179 "// Rust 2015" 105 USE@167..205
106 WHITESPACE@179..180 "\n" 106 COMMENT@167..179 "// Rust 2015"
107 USE@180..205 107 WHITESPACE@179..180 "\n"
108 USE_KW@180..183 "use" 108 USE_KW@180..183 "use"
109 WHITESPACE@183..184 " " 109 WHITESPACE@183..184 " "
110 USE_TREE@184..204 110 USE_TREE@184..204
diff --git a/crates/syntax/test_data/parser/inline/ok/0110_use_path.rast b/crates/syntax/test_data/parser/inline/ok/0110_use_path.rast
index 82028096f..c9fad5f8c 100644
--- a/crates/syntax/test_data/parser/inline/ok/0110_use_path.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0110_use_path.rast
@@ -10,9 +10,9 @@ SOURCE_FILE@0..154
10 IDENT@6..16 "crate_name" 10 IDENT@6..16 "crate_name"
11 SEMICOLON@16..17 ";" 11 SEMICOLON@16..17 ";"
12 WHITESPACE@17..18 " " 12 WHITESPACE@17..18 " "
13 COMMENT@18..45 "// Rust 2018 - All fl ..." 13 USE@18..61
14 WHITESPACE@45..46 "\n" 14 COMMENT@18..45 "// Rust 2018 - All fl ..."
15 USE@46..61 15 WHITESPACE@45..46 "\n"
16 USE_KW@46..49 "use" 16 USE_KW@46..49 "use"
17 WHITESPACE@49..50 " " 17 WHITESPACE@49..50 " "
18 USE_TREE@50..60 18 USE_TREE@50..60
@@ -22,9 +22,9 @@ SOURCE_FILE@0..154
22 IDENT@50..60 "crate_name" 22 IDENT@50..60 "crate_name"
23 SEMICOLON@60..61 ";" 23 SEMICOLON@60..61 ";"
24 WHITESPACE@61..62 " " 24 WHITESPACE@61..62 " "
25 COMMENT@62..91 "// Rust 2018 - Anchor ..." 25 USE@62..124
26 WHITESPACE@91..92 "\n" 26 COMMENT@62..91 "// Rust 2018 - Anchor ..."
27 USE@92..124 27 WHITESPACE@91..92 "\n"
28 USE_KW@92..95 "use" 28 USE_KW@92..95 "use"
29 WHITESPACE@95..96 " " 29 WHITESPACE@95..96 " "
30 USE_TREE@96..123 30 USE_TREE@96..123