mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Encode ident rawness and literal kind separately in tt::Leaf
This commit is contained in:
parent
5784915618
commit
e846c04fbe
33 changed files with 860 additions and 412 deletions
|
@ -269,12 +269,13 @@ fn get_doc_string_in_attr(it: &ast::Attr) -> Option<ast::String> {
|
|||
}
|
||||
|
||||
fn doc_indent(attrs: &hir::Attrs) -> usize {
|
||||
attrs
|
||||
.by_key("doc")
|
||||
.attrs()
|
||||
.filter_map(|attr| attr.string_value()) // no need to use unescape version here
|
||||
.flat_map(|s| s.lines())
|
||||
.filter_map(|line| line.chars().position(|c| !c.is_whitespace()))
|
||||
.min()
|
||||
.unwrap_or(0)
|
||||
let mut min = !0;
|
||||
for val in attrs.by_key("doc").attrs().filter_map(|attr| attr.string_value_unescape()) {
|
||||
if let Some(m) =
|
||||
val.lines().filter_map(|line| line.chars().position(|c| !c.is_whitespace())).min()
|
||||
{
|
||||
min = min.min(m);
|
||||
}
|
||||
}
|
||||
min
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue