Use minicore

This commit is contained in:
Yoshua Wuyts 2021-08-08 18:58:42 +02:00
parent 5a3c3a029c
commit f64aacc0c1
3 changed files with 27 additions and 84 deletions

View file

@ -2732,8 +2732,8 @@ fn foo() {
file_id: FileId(
1,
),
full_range: 251..433,
focus_range: 290..296,
full_range: 252..434,
focus_range: 291..297,
name: "Future",
kind: Trait,
description: "pub trait Future",

View file

@ -304,36 +304,19 @@ mod tests {
check_assist(
replace_derive_with_manual_impl,
r#"
mod fmt {
pub struct Error;
pub type Result = Result<(), Error>;
pub struct Formatter<'a>;
pub trait Debug {
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
}
}
//- minicore: fmt
#[derive(Debu$0g)]
struct Foo {
bar: String,
}
"#,
r#"
mod fmt {
pub struct Error;
pub type Result = Result<(), Error>;
pub struct Formatter<'a>;
pub trait Debug {
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
}
}
struct Foo {
bar: String,
}
impl fmt::Debug for Foo {
$0fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
impl core::fmt::Debug for Foo {
$0fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("Foo").field("bar", &self.bar).finish()
}
}
@ -345,32 +328,14 @@ impl fmt::Debug for Foo {
check_assist(
replace_derive_with_manual_impl,
r#"
mod fmt {
pub struct Error;
pub type Result = Result<(), Error>;
pub struct Formatter<'a>;
pub trait Debug {
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
}
}
//- minicore: fmt
#[derive(Debu$0g)]
struct Foo(String, usize);
"#,
r#"
mod fmt {
pub struct Error;
pub type Result = Result<(), Error>;
pub struct Formatter<'a>;
pub trait Debug {
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
}
}
r#"struct Foo(String, usize);
struct Foo(String, usize);
impl fmt::Debug for Foo {
$0fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
impl core::fmt::Debug for Foo {
$0fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_tuple("Foo").field(&self.0).field(&self.1).finish()
}
}
@ -382,32 +347,15 @@ impl fmt::Debug for Foo {
check_assist(
replace_derive_with_manual_impl,
r#"
mod fmt {
pub struct Error;
pub type Result = Result<(), Error>;
pub struct Formatter<'a>;
pub trait Debug {
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
}
}
//- minicore: fmt
#[derive(Debu$0g)]
struct Foo;
"#,
r#"
mod fmt {
pub struct Error;
pub type Result = Result<(), Error>;
pub struct Formatter<'a>;
pub trait Debug {
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
}
}
struct Foo;
impl fmt::Debug for Foo {
$0fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
impl core::fmt::Debug for Foo {
$0fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("Foo").finish()
}
}
@ -419,15 +367,7 @@ impl fmt::Debug for Foo {
check_assist(
replace_derive_with_manual_impl,
r#"
mod fmt {
pub struct Error;
pub type Result = Result<(), Error>;
pub struct Formatter<'a>;
pub trait Debug {
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
}
}
//- minicore: fmt
#[derive(Debu$0g)]
enum Foo {
Bar,
@ -435,22 +375,13 @@ enum Foo {
}
"#,
r#"
mod fmt {
pub struct Error;
pub type Result = Result<(), Error>;
pub struct Formatter<'a>;
pub trait Debug {
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
}
}
enum Foo {
Bar,
Baz,
}
impl fmt::Debug for Foo {
$0fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
impl core::fmt::Debug for Foo {
$0fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Bar => write!(f, "Bar"),
Self::Baz => write!(f, "Baz"),

View file

@ -31,6 +31,7 @@
//! eq: sized
//! ord: eq, option
//! derive:
//! fmt:
pub mod marker {
// region:sized
@ -334,6 +335,17 @@ pub mod cmp {
}
// endregion:eq
// region:fmt
pub mod fmt {
pub struct Error;
pub type Result = Result<(), Error>;
pub struct Formatter<'a>;
pub trait Debug {
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
}
}
// endregion:fmt
// region:slice
pub mod slice {
#[lang = "slice"]