aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yaml17
-rw-r--r--crates/ra_ide/src/inlay_hints.rs17
-rw-r--r--editors/code/src/inlay_hints.ts10
3 files changed, 20 insertions, 24 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 02a3b6228..00f299ff1 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -20,25 +20,14 @@ jobs:
20 name: Audit Rust vulnerabilities 20 name: Audit Rust vulnerabilities
21 runs-on: ubuntu-latest 21 runs-on: ubuntu-latest
22 steps: 22 steps:
23 - name: Install Rust toolchain
24 uses: actions-rs/toolchain@v1
25 with:
26 toolchain: stable
27 profile: minimal
28 override: true
29
30 - name: Checkout repository 23 - name: Checkout repository
31 uses: actions/checkout@v2 24 uses: actions/checkout@v2
32 25
33 - run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/ 26 - uses: actions-rs/[email protected]
34
35 - name: Cache cargo
36 uses: actions/cache@v1
37 with: 27 with:
38 path: ~/.cargo/ 28 crate: cargo-audit
39 key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} 29 use-tool-cache: true
40 30
41 - run: cargo install cargo-audit
42 - run: cargo audit 31 - run: cargo audit
43 32
44 rust: 33 rust:
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs
index da9f55a69..45b9f7802 100644
--- a/crates/ra_ide/src/inlay_hints.rs
+++ b/crates/ra_ide/src/inlay_hints.rs
@@ -235,7 +235,10 @@ fn should_show_param_hint(
235 param_name: &str, 235 param_name: &str,
236 argument: &ast::Expr, 236 argument: &ast::Expr,
237) -> bool { 237) -> bool {
238 if param_name.is_empty() || is_argument_similar_to_param(argument, param_name) { 238 if param_name.is_empty()
239 || is_argument_similar_to_param(argument, param_name)
240 || Some(param_name) == fn_signature.name.as_ref().map(String::as_str)
241 {
239 return false; 242 return false;
240 } 243 }
241 244
@@ -247,10 +250,7 @@ fn should_show_param_hint(
247 250
248 // avoid displaying hints for common functions like map, filter, etc. 251 // avoid displaying hints for common functions like map, filter, etc.
249 // or other obvious words used in std 252 // or other obvious words used in std
250 if parameters_len == 1 && is_obvious_param(param_name) { 253 parameters_len != 1 || !is_obvious_param(param_name)
251 return false;
252 }
253 true
254} 254}
255 255
256fn is_argument_similar_to_param(argument: &ast::Expr, param_name: &str) -> bool { 256fn is_argument_similar_to_param(argument: &ast::Expr, param_name: &str) -> bool {
@@ -1086,6 +1086,8 @@ impl Test {
1086 } 1086 }
1087 1087
1088 fn no_hints_expected(&self, _: i32, test_var: i32) {} 1088 fn no_hints_expected(&self, _: i32, test_var: i32) {}
1089
1090 fn frob(&self, frob: bool) {}
1089} 1091}
1090 1092
1091struct Param {} 1093struct Param {}
@@ -1093,6 +1095,8 @@ struct Param {}
1093fn different_order(param: &Param) {} 1095fn different_order(param: &Param) {}
1094fn different_order_mut(param: &mut Param) {} 1096fn different_order_mut(param: &mut Param) {}
1095 1097
1098fn twiddle(twiddle: bool) {}
1099
1096fn main() { 1100fn main() {
1097 let container: TestVarContainer = TestVarContainer { test_var: 42 }; 1101 let container: TestVarContainer = TestVarContainer { test_var: 42 };
1098 let test: Test = Test {}; 1102 let test: Test = Test {};
@@ -1105,6 +1109,9 @@ fn main() {
1105 let test_var: i32 = 55; 1109 let test_var: i32 = 55;
1106 test_processed.no_hints_expected(22, test_var); 1110 test_processed.no_hints_expected(22, test_var);
1107 test_processed.no_hints_expected(33, container.test_var); 1111 test_processed.no_hints_expected(33, container.test_var);
1112 test_processed.frob(false);
1113
1114 twiddle(true);
1108 1115
1109 let param_begin: Param = Param {}; 1116 let param_begin: Param = Param {};
1110 different_order(&param_begin); 1117 different_order(&param_begin);
diff --git a/editors/code/src/inlay_hints.ts b/editors/code/src/inlay_hints.ts
index 6a8bd942e..da74f03d2 100644
--- a/editors/code/src/inlay_hints.ts
+++ b/editors/code/src/inlay_hints.ts
@@ -229,13 +229,13 @@ interface InlaysDecorations {
229} 229}
230 230
231interface RustSourceFile { 231interface RustSourceFile {
232 /* 232 /**
233 * Source of the token to cancel in-flight inlay hints request if any. 233 * Source of the token to cancel in-flight inlay hints request if any.
234 */ 234 */
235 inlaysRequest: null | vscode.CancellationTokenSource; 235 inlaysRequest: null | vscode.CancellationTokenSource;
236 /** 236 /**
237 * Last applied decorations. 237 * Last applied decorations.
238 */ 238 */
239 cachedDecorations: null | InlaysDecorations; 239 cachedDecorations: null | InlaysDecorations;
240 240
241 document: RustDocument; 241 document: RustDocument;