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>
This commit is contained in:
commit
03b886de53
@ -83,7 +83,6 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> {
|
||||
fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> {
|
||||
match kind {
|
||||
COMMENT => Some(FoldKind::Comment),
|
||||
USE => Some(FoldKind::Imports),
|
||||
ARG_LIST | PARAM_LIST => Some(FoldKind::ArgList),
|
||||
ASSOC_ITEM_LIST
|
||||
| RECORD_FIELD_LIST
|
||||
@ -258,11 +257,11 @@ fn main() <fold block>{
|
||||
fn test_fold_imports() {
|
||||
check(
|
||||
r#"
|
||||
<fold imports>use std::<fold block>{
|
||||
use std::<fold block>{
|
||||
str,
|
||||
vec,
|
||||
io as iop
|
||||
}</fold>;</fold>
|
||||
}</fold>;
|
||||
|
||||
fn main() <fold block>{
|
||||
}</fold>"#,
|
||||
@ -306,9 +305,9 @@ fn test_fold_import_groups() {
|
||||
<fold imports>use std::mem;
|
||||
use std::f64;</fold>
|
||||
|
||||
use std::collections::HashMap;
|
||||
<fold imports>use std::collections::HashMap;
|
||||
// Some random comment
|
||||
use std::collections::VecDeque;
|
||||
use std::collections::VecDeque;</fold>
|
||||
|
||||
fn main() <fold block>{
|
||||
}</fold>"#,
|
||||
@ -326,10 +325,10 @@ fn test_fold_import_and_groups() {
|
||||
<fold imports>use std::mem;
|
||||
use std::f64;</fold>
|
||||
|
||||
<fold imports>use std::collections::<fold block>{
|
||||
use std::collections::<fold block>{
|
||||
HashMap,
|
||||
VecDeque,
|
||||
}</fold>;</fold>
|
||||
}</fold>;
|
||||
// Some random comment
|
||||
|
||||
fn main() <fold block>{
|
||||
|
@ -477,3 +477,4 @@ impl ast::DocCommentsOwner for ast::Const {}
|
||||
impl ast::DocCommentsOwner for ast::TypeAlias {}
|
||||
impl ast::DocCommentsOwner for ast::Impl {}
|
||||
impl ast::DocCommentsOwner for ast::MacroCall {}
|
||||
impl ast::DocCommentsOwner for ast::Use {}
|
||||
|
@ -148,7 +148,7 @@ fn n_attached_trivias<'a>(
|
||||
) -> usize {
|
||||
match kind {
|
||||
MACRO_CALL | CONST | TYPE_ALIAS | STRUCT | ENUM | VARIANT | FN | TRAIT | MODULE
|
||||
| RECORD_FIELD | STATIC => {
|
||||
| RECORD_FIELD | STATIC | USE => {
|
||||
let mut res = 0;
|
||||
let mut trivias = trivias.enumerate().peekable();
|
||||
|
||||
|
@ -49,9 +49,9 @@ SOURCE_FILE@0..249
|
||||
R_CURLY@56..57 "}"
|
||||
SEMICOLON@57..58 ";"
|
||||
WHITESPACE@58..59 " "
|
||||
COMMENT@59..97 "// Rust 2018 (with a ..."
|
||||
WHITESPACE@97..98 "\n"
|
||||
USE@98..121
|
||||
USE@59..121
|
||||
COMMENT@59..97 "// Rust 2018 (with a ..."
|
||||
WHITESPACE@97..98 "\n"
|
||||
USE_KW@98..101 "use"
|
||||
WHITESPACE@101..102 " "
|
||||
USE_TREE@102..120
|
||||
@ -75,9 +75,9 @@ SOURCE_FILE@0..249
|
||||
R_CURLY@119..120 "}"
|
||||
SEMICOLON@120..121 ";"
|
||||
WHITESPACE@121..122 " "
|
||||
COMMENT@122..134 "// Rust 2015"
|
||||
WHITESPACE@134..135 "\n"
|
||||
USE@135..166
|
||||
USE@122..166
|
||||
COMMENT@122..134 "// Rust 2015"
|
||||
WHITESPACE@134..135 "\n"
|
||||
USE_KW@135..138 "use"
|
||||
WHITESPACE@138..139 " "
|
||||
USE_TREE@139..165
|
||||
@ -102,9 +102,9 @@ SOURCE_FILE@0..249
|
||||
R_CURLY@164..165 "}"
|
||||
SEMICOLON@165..166 ";"
|
||||
WHITESPACE@166..167 " "
|
||||
COMMENT@167..179 "// Rust 2015"
|
||||
WHITESPACE@179..180 "\n"
|
||||
USE@180..205
|
||||
USE@167..205
|
||||
COMMENT@167..179 "// Rust 2015"
|
||||
WHITESPACE@179..180 "\n"
|
||||
USE_KW@180..183 "use"
|
||||
WHITESPACE@183..184 " "
|
||||
USE_TREE@184..204
|
||||
|
@ -10,9 +10,9 @@ SOURCE_FILE@0..154
|
||||
IDENT@6..16 "crate_name"
|
||||
SEMICOLON@16..17 ";"
|
||||
WHITESPACE@17..18 " "
|
||||
COMMENT@18..45 "// Rust 2018 - All fl ..."
|
||||
WHITESPACE@45..46 "\n"
|
||||
USE@46..61
|
||||
USE@18..61
|
||||
COMMENT@18..45 "// Rust 2018 - All fl ..."
|
||||
WHITESPACE@45..46 "\n"
|
||||
USE_KW@46..49 "use"
|
||||
WHITESPACE@49..50 " "
|
||||
USE_TREE@50..60
|
||||
@ -22,9 +22,9 @@ SOURCE_FILE@0..154
|
||||
IDENT@50..60 "crate_name"
|
||||
SEMICOLON@60..61 ";"
|
||||
WHITESPACE@61..62 " "
|
||||
COMMENT@62..91 "// Rust 2018 - Anchor ..."
|
||||
WHITESPACE@91..92 "\n"
|
||||
USE@92..124
|
||||
USE@62..124
|
||||
COMMENT@62..91 "// Rust 2018 - Anchor ..."
|
||||
WHITESPACE@91..92 "\n"
|
||||
USE_KW@92..95 "use"
|
||||
WHITESPACE@95..96 " "
|
||||
USE_TREE@96..123
|
||||
|
Loading…
Reference in New Issue
Block a user