Skip to content

Commit 2e764b3

Browse files
committed
add completions for clippy lint in attributes
Signed-off-by: Benjamin Coenen <[email protected]>
2 parents 0cf35ae + 989de9e commit 2e764b3

File tree

94 files changed

+2251
-794
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+2251
-794
lines changed

.github/actions/github-release/main.js

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ async function runOnce() {
7070
repo,
7171
name,
7272
tag_name: name,
73+
target_commitish: sha,
7374
prerelease: name === 'nightly',
7475
});
7576

.github/workflows/release.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,16 @@ jobs:
7979
with:
8080
node-version: 12.x
8181

82-
- run: echo "::set-env name=TAG::$(date --iso --utc)"
82+
- run: echo "TAG=$(date --iso --utc)" >> $GITHUB_ENV
8383
if: github.ref == 'refs/heads/release'
84-
- run: echo "::set-env name=TAG::nightly"
84+
- run: echo "TAG=nightly" >> $GITHUB_ENV
8585
if: github.ref != 'refs/heads/release'
8686
- run: 'echo "TAG: $TAG"'
8787

8888
- name: Checkout repository
8989
uses: actions/checkout@v2
9090

91-
- run: echo "::set-env name=HEAD_SHA::$(git rev-parse HEAD)"
91+
- run: echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
9292
- run: 'echo "HEAD_SHA: $HEAD_SHA"'
9393

9494
- uses: actions/download-artifact@v1

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ crates/*/target
99
.vscode/settings.json
1010
generated_assists.adoc
1111
generated_features.adoc
12+
generated_diagnostic.adoc

Cargo.lock

+62-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/assists/src/handlers/auto_import.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::{
66
AssistContext, AssistId, AssistKind, Assists, GroupLabel,
77
};
88

9-
// Feature: Import Insertion
9+
// Feature: Auto Import
1010
//
1111
// Using the `auto-import` assist it is possible to insert missing imports for unresolved items.
1212
// When inserting an import it will do so in a structured manner by keeping imports grouped,
@@ -100,7 +100,7 @@ pub(crate) fn auto_import(acc: &mut Assists, ctx: &AssistContext) -> Option<()>
100100
let group = import_group_message(import_assets.import_candidate());
101101
let scope = ImportScope::find_insert_use_container(import_assets.syntax_under_caret(), ctx)?;
102102
let syntax = scope.as_syntax_node();
103-
for import in proposed_imports {
103+
for (import, _) in proposed_imports {
104104
acc.add_group(
105105
&group,
106106
AssistId("auto_import", AssistKind::QuickFix),

crates/assists/src/handlers/change_visibility.rs

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use syntax::{
22
ast::{self, NameOwner, VisibilityOwner},
33
AstNode,
4-
SyntaxKind::{CONST, ENUM, FN, MODULE, STATIC, STRUCT, TRAIT, VISIBILITY},
4+
SyntaxKind::{CONST, ENUM, FN, MODULE, STATIC, STRUCT, TRAIT, TYPE_ALIAS, VISIBILITY},
55
T,
66
};
77
use test_utils::mark;
@@ -30,13 +30,20 @@ fn add_vis(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
3030
let item_keyword = ctx.token_at_offset().find(|leaf| {
3131
matches!(
3232
leaf.kind(),
33-
T![const] | T![static] | T![fn] | T![mod] | T![struct] | T![enum] | T![trait]
33+
T![const]
34+
| T![static]
35+
| T![fn]
36+
| T![mod]
37+
| T![struct]
38+
| T![enum]
39+
| T![trait]
40+
| T![type]
3441
)
3542
});
3643

3744
let (offset, target) = if let Some(keyword) = item_keyword {
3845
let parent = keyword.parent();
39-
let def_kws = vec![CONST, STATIC, FN, MODULE, STRUCT, ENUM, TRAIT];
46+
let def_kws = vec![CONST, STATIC, TYPE_ALIAS, FN, MODULE, STRUCT, ENUM, TRAIT];
4047
// Parent is not a definition, can't add visibility
4148
if !def_kws.iter().any(|&def_kw| def_kw == parent.kind()) {
4249
return None;
@@ -159,6 +166,11 @@ mod tests {
159166
check_assist(change_visibility, "<|>static FOO = 3u8;", "pub(crate) static FOO = 3u8;");
160167
}
161168

169+
#[test]
170+
fn change_visibility_type_alias() {
171+
check_assist(change_visibility, "<|>type T = ();", "pub(crate) type T = ();");
172+
}
173+
162174
#[test]
163175
fn change_visibility_handles_comment_attrs() {
164176
check_assist(

crates/assists/src/handlers/fill_match_arms.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub(crate) fn fill_match_arms(acc: &mut Assists, ctx: &AssistContext) -> Option<
5959
.filter(|variant_pat| is_variant_missing(&mut arms, variant_pat))
6060
.map(|pat| make::match_arm(iter::once(pat), make::expr_empty_block()))
6161
.collect::<Vec<_>>();
62-
if Some(enum_def) == FamousDefs(&ctx.sema, module.krate()).core_option_Option() {
62+
if Some(enum_def) == FamousDefs(&ctx.sema, Some(module.krate())).core_option_Option() {
6363
// Match `Some` variant first.
6464
mark::hit!(option_order);
6565
variants.reverse()

crates/assists/src/handlers/fix_visibility.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
use base_db::FileId;
22
use hir::{db::HirDatabase, HasSource, HasVisibility, PathResolution};
3-
use syntax::{ast, AstNode, TextRange, TextSize};
3+
use syntax::{
4+
ast::{self, VisibilityOwner},
5+
AstNode, TextRange, TextSize,
6+
};
47

58
use crate::{utils::vis_offset, AssistContext, AssistId, AssistKind, Assists};
6-
use ast::VisibilityOwner;
79

810
// FIXME: this really should be a fix for diagnostic, rather than an assist.
911

crates/assists/src/handlers/generate_from_impl_for_enum.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ fn existing_from_impl(
7575
let enum_ = variant.parent_enum(sema.db);
7676
let krate = enum_.module(sema.db).krate();
7777

78-
let from_trait = FamousDefs(sema, krate).core_convert_From()?;
78+
let from_trait = FamousDefs(sema, Some(krate)).core_convert_From()?;
7979

8080
let enum_type = enum_.ty(sema.db);
8181

0 commit comments

Comments
 (0)