From 08c220ab2c4651f38d3029898706f2a996bf2c6b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 17 Jun 2021 20:49:49 +0300 Subject: internal: add default to minicore --- crates/ide_completion/src/completions/record.rs | 28 +++++++------------------ 1 file changed, 7 insertions(+), 21 deletions(-) (limited to 'crates/ide_completion') diff --git a/crates/ide_completion/src/completions/record.rs b/crates/ide_completion/src/completions/record.rs index 47523f72f..e876337f1 100644 --- a/crates/ide_completion/src/completions/record.rs +++ b/crates/ide_completion/src/completions/record.rs @@ -48,10 +48,9 @@ pub(crate) fn complete_record(acc: &mut Completions, ctx: &CompletionContext) -> #[cfg(test)] mod tests { use expect_test::{expect, Expect}; - use ide_db::helpers::FamousDefs; use crate::{ - tests::{self, filtered_completion_list}, + tests::{check_edit, filtered_completion_list}, CompletionKind, }; @@ -61,31 +60,17 @@ mod tests { } fn check_snippet(ra_fixture: &str, expect: Expect) { - let actual = filtered_completion_list( - &format!("//- /main.rs crate:main deps:core\n{}\n{}", ra_fixture, FamousDefs::FIXTURE), - CompletionKind::Snippet, - ); + let actual = filtered_completion_list(ra_fixture, CompletionKind::Snippet); expect.assert_eq(&actual); } - fn check_edit(what: &str, ra_fixture_before: &str, ra_fixture_after: &str) { - tests::check_edit( - what, - &format!( - "//- /main.rs crate:main deps:core{}\n{}", - ra_fixture_before, - FamousDefs::FIXTURE, - ), - &(ra_fixture_after.to_owned() + "\n"), - ); - } - #[test] fn test_record_literal_field_default() { let test_code = r#" +//- minicore: default struct S { foo: u32, bar: usize } -impl core::default::Default for S { +impl Default for S { fn default() -> Self { S { foo: 0, @@ -121,9 +106,10 @@ fn process(f: S) { check_edit( "..Default::default()", r#" +//- minicore: default struct S { foo: u32, bar: usize } -impl core::default::Default for S { +impl Default for S { fn default() -> Self { S { foo: 0, @@ -142,7 +128,7 @@ fn process(f: S) { r#" struct S { foo: u32, bar: usize } -impl core::default::Default for S { +impl Default for S { fn default() -> Self { S { foo: 0, -- cgit v1.2.3