diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-01-14 15:27:20 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-14 15:27:20 +0000 |
commit | 540edee3cd11d45a03abc072bb9b6f01b59bcb25 (patch) | |
tree | 7d86fca4364984808724ccc5694aef20a43d686c /crates/completion | |
parent | aeacaeed4e49dd71ba0de30a21d9f3d1cc153cec (diff) | |
parent | 8dc68ecdfcc764c7c0dcf5fcedcb51b092d99620 (diff) |
Merge #7270
7270: Introduce more appropriate assertion mechanism r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/completion')
-rw-r--r-- | crates/completion/src/completions/qualified_path.rs | 3 | ||||
-rw-r--r-- | crates/completion/src/completions/unqualified_path.rs | 6 | ||||
-rw-r--r-- | crates/completion/src/item.rs | 4 |
3 files changed, 7 insertions, 6 deletions
diff --git a/crates/completion/src/completions/qualified_path.rs b/crates/completion/src/completions/qualified_path.rs index fa9e6e810..33df26761 100644 --- a/crates/completion/src/completions/qualified_path.rs +++ b/crates/completion/src/completions/qualified_path.rs | |||
@@ -590,8 +590,7 @@ fn main() { let _ = crate::$0 } | |||
590 | "#, | 590 | "#, |
591 | expect![[r##" | 591 | expect![[r##" |
592 | fn main() fn main() | 592 | fn main() fn main() |
593 | ma foo!(…) #[macro_export] | 593 | ma foo!(…) #[macro_export] macro_rules! foo |
594 | macro_rules! foo | ||
595 | "##]], | 594 | "##]], |
596 | ); | 595 | ); |
597 | } | 596 | } |
diff --git a/crates/completion/src/completions/unqualified_path.rs b/crates/completion/src/completions/unqualified_path.rs index 7ba99447d..53e1391f3 100644 --- a/crates/completion/src/completions/unqualified_path.rs +++ b/crates/completion/src/completions/unqualified_path.rs | |||
@@ -540,8 +540,7 @@ mod macros { | |||
540 | "#, | 540 | "#, |
541 | expect![[r##" | 541 | expect![[r##" |
542 | fn f() fn f() | 542 | fn f() fn f() |
543 | ma concat!(…) #[macro_export] | 543 | ma concat!(…) #[macro_export] macro_rules! concat |
544 | macro_rules! concat | ||
545 | md std | 544 | md std |
546 | "##]], | 545 | "##]], |
547 | ); | 546 | ); |
@@ -597,8 +596,7 @@ fn main() { let v = $0 } | |||
597 | "#, | 596 | "#, |
598 | expect![[r##" | 597 | expect![[r##" |
599 | md m1 | 598 | md m1 |
600 | ma baz!(…) #[macro_export] | 599 | ma baz!(…) #[macro_export] macro_rules! baz |
601 | macro_rules! baz | ||
602 | fn main() fn main() | 600 | fn main() fn main() |
603 | md m2 | 601 | md m2 |
604 | ma bar!(…) macro_rules! bar | 602 | ma bar!(…) macro_rules! bar |
diff --git a/crates/completion/src/item.rs b/crates/completion/src/item.rs index 35af354b0..0134ff219 100644 --- a/crates/completion/src/item.rs +++ b/crates/completion/src/item.rs | |||
@@ -7,6 +7,7 @@ use ide_db::helpers::{ | |||
7 | insert_use::{self, ImportScope, MergeBehavior}, | 7 | insert_use::{self, ImportScope, MergeBehavior}, |
8 | mod_path_to_ast, SnippetCap, | 8 | mod_path_to_ast, SnippetCap, |
9 | }; | 9 | }; |
10 | use stdx::assert_never; | ||
10 | use syntax::{algo, TextRange}; | 11 | use syntax::{algo, TextRange}; |
11 | use text_edit::TextEdit; | 12 | use text_edit::TextEdit; |
12 | 13 | ||
@@ -396,6 +397,9 @@ impl Builder { | |||
396 | } | 397 | } |
397 | pub(crate) fn set_detail(mut self, detail: Option<impl Into<String>>) -> Builder { | 398 | pub(crate) fn set_detail(mut self, detail: Option<impl Into<String>>) -> Builder { |
398 | self.detail = detail.map(Into::into); | 399 | self.detail = detail.map(Into::into); |
400 | if let Some(detail) = &self.detail { | ||
401 | assert_never!(detail.contains('\n'), "multiline detail: {}", detail); | ||
402 | } | ||
399 | self | 403 | self |
400 | } | 404 | } |
401 | #[allow(unused)] | 405 | #[allow(unused)] |