diff options
| author | bit-aloo <sshourya17@gmail.com> | 2025-02-26 22:19:22 +0530 |
|---|---|---|
| committer | bit-aloo <sshourya17@gmail.com> | 2025-02-28 10:03:03 +0530 |
| commit | 2071cc27f23aa0134e2a1f8bf3328f371ee559be (patch) | |
| tree | 113f669e6bec01cff06583d0b3deef7028c5ac3c /src/tools/rust-analyzer | |
| parent | 73488449c53821a8f4860f67e8580fc9eeb65e26 (diff) | |
| download | rust-2071cc27f23aa0134e2a1f8bf3328f371ee559be.tar.gz rust-2071cc27f23aa0134e2a1f8bf3328f371ee559be.zip | |
add test
Diffstat (limited to 'src/tools/rust-analyzer')
| -rw-r--r-- | src/tools/rust-analyzer/crates/ide-completion/src/render.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/render.rs b/src/tools/rust-analyzer/crates/ide-completion/src/render.rs index d9f3fe13267..4f6c4cb6639 100644 --- a/src/tools/rust-analyzer/crates/ide-completion/src/render.rs +++ b/src/tools/rust-analyzer/crates/ide-completion/src/render.rs @@ -2006,6 +2006,30 @@ fn f() { } #[test] + fn test_avoid_redundant_suggestion() { + check_relevance( + r#" +struct aa([u8]); + +impl aa { + fn from_bytes(bytes: &[u8]) -> &Self { + unsafe { &*(bytes as *const [u8] as *const aa) } + } +} + +fn bb()-> &'static aa { + let bytes = b"hello"; + aa::$0 +} +"#, + expect![[r#" + ex bb() [type] + fn from_bytes(…) fn(&[u8]) -> &aa [type_could_unify] + "#]], + ); + } + + #[test] fn suggest_ref_mut() { cov_mark::check!(suggest_ref); check_relevance( |
