mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Use minicore
This commit is contained in:
parent
5a3c3a029c
commit
f64aacc0c1
3 changed files with 27 additions and 84 deletions
|
@ -2732,8 +2732,8 @@ fn foo() {
|
||||||
file_id: FileId(
|
file_id: FileId(
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
full_range: 251..433,
|
full_range: 252..434,
|
||||||
focus_range: 290..296,
|
focus_range: 291..297,
|
||||||
name: "Future",
|
name: "Future",
|
||||||
kind: Trait,
|
kind: Trait,
|
||||||
description: "pub trait Future",
|
description: "pub trait Future",
|
||||||
|
|
|
@ -304,36 +304,19 @@ mod tests {
|
||||||
check_assist(
|
check_assist(
|
||||||
replace_derive_with_manual_impl,
|
replace_derive_with_manual_impl,
|
||||||
r#"
|
r#"
|
||||||
mod fmt {
|
//- minicore: fmt
|
||||||
pub struct Error;
|
|
||||||
pub type Result = Result<(), Error>;
|
|
||||||
pub struct Formatter<'a>;
|
|
||||||
pub trait Debug {
|
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debu$0g)]
|
#[derive(Debu$0g)]
|
||||||
struct Foo {
|
struct Foo {
|
||||||
bar: String,
|
bar: String,
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
r#"
|
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 {
|
struct Foo {
|
||||||
bar: String,
|
bar: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for Foo {
|
impl core::fmt::Debug for Foo {
|
||||||
$0fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
$0fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||||
f.debug_struct("Foo").field("bar", &self.bar).finish()
|
f.debug_struct("Foo").field("bar", &self.bar).finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -345,32 +328,14 @@ impl fmt::Debug for Foo {
|
||||||
check_assist(
|
check_assist(
|
||||||
replace_derive_with_manual_impl,
|
replace_derive_with_manual_impl,
|
||||||
r#"
|
r#"
|
||||||
mod fmt {
|
//- minicore: fmt
|
||||||
pub struct Error;
|
|
||||||
pub type Result = Result<(), Error>;
|
|
||||||
pub struct Formatter<'a>;
|
|
||||||
pub trait Debug {
|
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debu$0g)]
|
#[derive(Debu$0g)]
|
||||||
struct Foo(String, usize);
|
struct Foo(String, usize);
|
||||||
"#,
|
"#,
|
||||||
r#"
|
r#"struct Foo(String, usize);
|
||||||
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(String, usize);
|
impl core::fmt::Debug for Foo {
|
||||||
|
$0fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||||
impl fmt::Debug for Foo {
|
|
||||||
$0fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
||||||
f.debug_tuple("Foo").field(&self.0).field(&self.1).finish()
|
f.debug_tuple("Foo").field(&self.0).field(&self.1).finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -382,32 +347,15 @@ impl fmt::Debug for Foo {
|
||||||
check_assist(
|
check_assist(
|
||||||
replace_derive_with_manual_impl,
|
replace_derive_with_manual_impl,
|
||||||
r#"
|
r#"
|
||||||
mod fmt {
|
//- minicore: fmt
|
||||||
pub struct Error;
|
|
||||||
pub type Result = Result<(), Error>;
|
|
||||||
pub struct Formatter<'a>;
|
|
||||||
pub trait Debug {
|
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debu$0g)]
|
#[derive(Debu$0g)]
|
||||||
struct Foo;
|
struct Foo;
|
||||||
"#,
|
"#,
|
||||||
r#"
|
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;
|
struct Foo;
|
||||||
|
|
||||||
impl fmt::Debug for Foo {
|
impl core::fmt::Debug for Foo {
|
||||||
$0fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
$0fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||||
f.debug_struct("Foo").finish()
|
f.debug_struct("Foo").finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -419,15 +367,7 @@ impl fmt::Debug for Foo {
|
||||||
check_assist(
|
check_assist(
|
||||||
replace_derive_with_manual_impl,
|
replace_derive_with_manual_impl,
|
||||||
r#"
|
r#"
|
||||||
mod fmt {
|
//- minicore: fmt
|
||||||
pub struct Error;
|
|
||||||
pub type Result = Result<(), Error>;
|
|
||||||
pub struct Formatter<'a>;
|
|
||||||
pub trait Debug {
|
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debu$0g)]
|
#[derive(Debu$0g)]
|
||||||
enum Foo {
|
enum Foo {
|
||||||
Bar,
|
Bar,
|
||||||
|
@ -435,22 +375,13 @@ enum Foo {
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
r#"
|
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 {
|
enum Foo {
|
||||||
Bar,
|
Bar,
|
||||||
Baz,
|
Baz,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for Foo {
|
impl core::fmt::Debug for Foo {
|
||||||
$0fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
$0fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Self::Bar => write!(f, "Bar"),
|
Self::Bar => write!(f, "Bar"),
|
||||||
Self::Baz => write!(f, "Baz"),
|
Self::Baz => write!(f, "Baz"),
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
//! eq: sized
|
//! eq: sized
|
||||||
//! ord: eq, option
|
//! ord: eq, option
|
||||||
//! derive:
|
//! derive:
|
||||||
|
//! fmt:
|
||||||
|
|
||||||
pub mod marker {
|
pub mod marker {
|
||||||
// region:sized
|
// region:sized
|
||||||
|
@ -334,6 +335,17 @@ pub mod cmp {
|
||||||
}
|
}
|
||||||
// endregion:eq
|
// 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
|
// region:slice
|
||||||
pub mod slice {
|
pub mod slice {
|
||||||
#[lang = "slice"]
|
#[lang = "slice"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue