mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
Support expect in attribute completion and hover
This commit is contained in:
parent
b3a3bf770a
commit
a6572e9234
4 changed files with 52 additions and 5 deletions
|
@ -329,7 +329,7 @@ pub(super) fn try_for_lint(attr: &ast::Attr, token: &SyntaxToken) -> Option<Hove
|
|||
}
|
||||
let (is_clippy, lints) = match &*path {
|
||||
"feature" => (false, FEATURES),
|
||||
"allow" | "deny" | "forbid" | "warn" => {
|
||||
"allow" | "deny" | "expect" | "forbid" | "warn" => {
|
||||
let is_clippy = algo::non_trivia_sibling(token.clone().into(), Direction::Prev)
|
||||
.filter(|t| t.kind() == T![:])
|
||||
.and_then(|t| algo::non_trivia_sibling(t, Direction::Prev))
|
||||
|
|
|
@ -6336,7 +6336,19 @@ fn hover_lint() {
|
|||
|
||||
arithmetic operation overflows
|
||||
"#]],
|
||||
)
|
||||
);
|
||||
check(
|
||||
r#"#![expect(arithmetic_overflow$0)]"#,
|
||||
expect![[r#"
|
||||
*arithmetic_overflow*
|
||||
```
|
||||
arithmetic_overflow
|
||||
```
|
||||
___
|
||||
|
||||
arithmetic operation overflows
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -6352,7 +6364,19 @@ fn hover_clippy_lint() {
|
|||
|
||||
Checks for `foo = bar; bar = foo` sequences.
|
||||
"#]],
|
||||
)
|
||||
);
|
||||
check(
|
||||
r#"#![expect(clippy::almost_swapped$0)]"#,
|
||||
expect![[r#"
|
||||
*almost_swapped*
|
||||
```
|
||||
clippy::almost_swapped
|
||||
```
|
||||
___
|
||||
|
||||
Checks for `foo = bar; bar = foo` sequences.
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue