Skip to content

Commit f64aacc

Browse files
committed
Use minicore
1 parent 5a3c3a0 commit f64aacc

File tree

3 files changed

+27
-84
lines changed

3 files changed

+27
-84
lines changed

crates/ide/src/hover.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2732,8 +2732,8 @@ fn foo() {
27322732
file_id: FileId(
27332733
1,
27342734
),
2735-
full_range: 251..433,
2736-
focus_range: 290..296,
2735+
full_range: 252..434,
2736+
focus_range: 291..297,
27372737
name: "Future",
27382738
kind: Trait,
27392739
description: "pub trait Future",

crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs

Lines changed: 13 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -304,36 +304,19 @@ mod tests {
304304
check_assist(
305305
replace_derive_with_manual_impl,
306306
r#"
307-
mod fmt {
308-
pub struct Error;
309-
pub type Result = Result<(), Error>;
310-
pub struct Formatter<'a>;
311-
pub trait Debug {
312-
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
313-
}
314-
}
315-
307+
//- minicore: fmt
316308
#[derive(Debu$0g)]
317309
struct Foo {
318310
bar: String,
319311
}
320312
"#,
321313
r#"
322-
mod fmt {
323-
pub struct Error;
324-
pub type Result = Result<(), Error>;
325-
pub struct Formatter<'a>;
326-
pub trait Debug {
327-
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
328-
}
329-
}
330-
331314
struct Foo {
332315
bar: String,
333316
}
334317
335-
impl fmt::Debug for Foo {
336-
$0fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
318+
impl core::fmt::Debug for Foo {
319+
$0fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
337320
f.debug_struct("Foo").field("bar", &self.bar).finish()
338321
}
339322
}
@@ -345,32 +328,14 @@ impl fmt::Debug for Foo {
345328
check_assist(
346329
replace_derive_with_manual_impl,
347330
r#"
348-
mod fmt {
349-
pub struct Error;
350-
pub type Result = Result<(), Error>;
351-
pub struct Formatter<'a>;
352-
pub trait Debug {
353-
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
354-
}
355-
}
356-
331+
//- minicore: fmt
357332
#[derive(Debu$0g)]
358333
struct Foo(String, usize);
359334
"#,
360-
r#"
361-
mod fmt {
362-
pub struct Error;
363-
pub type Result = Result<(), Error>;
364-
pub struct Formatter<'a>;
365-
pub trait Debug {
366-
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
367-
}
368-
}
369-
370-
struct Foo(String, usize);
335+
r#"struct Foo(String, usize);
371336
372-
impl fmt::Debug for Foo {
373-
$0fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
337+
impl core::fmt::Debug for Foo {
338+
$0fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
374339
f.debug_tuple("Foo").field(&self.0).field(&self.1).finish()
375340
}
376341
}
@@ -382,32 +347,15 @@ impl fmt::Debug for Foo {
382347
check_assist(
383348
replace_derive_with_manual_impl,
384349
r#"
385-
mod fmt {
386-
pub struct Error;
387-
pub type Result = Result<(), Error>;
388-
pub struct Formatter<'a>;
389-
pub trait Debug {
390-
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
391-
}
392-
}
393-
350+
//- minicore: fmt
394351
#[derive(Debu$0g)]
395352
struct Foo;
396353
"#,
397354
r#"
398-
mod fmt {
399-
pub struct Error;
400-
pub type Result = Result<(), Error>;
401-
pub struct Formatter<'a>;
402-
pub trait Debug {
403-
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
404-
}
405-
}
406-
407355
struct Foo;
408356
409-
impl fmt::Debug for Foo {
410-
$0fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
357+
impl core::fmt::Debug for Foo {
358+
$0fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
411359
f.debug_struct("Foo").finish()
412360
}
413361
}
@@ -419,38 +367,21 @@ impl fmt::Debug for Foo {
419367
check_assist(
420368
replace_derive_with_manual_impl,
421369
r#"
422-
mod fmt {
423-
pub struct Error;
424-
pub type Result = Result<(), Error>;
425-
pub struct Formatter<'a>;
426-
pub trait Debug {
427-
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
428-
}
429-
}
430-
370+
//- minicore: fmt
431371
#[derive(Debu$0g)]
432372
enum Foo {
433373
Bar,
434374
Baz,
435375
}
436376
"#,
437377
r#"
438-
mod fmt {
439-
pub struct Error;
440-
pub type Result = Result<(), Error>;
441-
pub struct Formatter<'a>;
442-
pub trait Debug {
443-
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
444-
}
445-
}
446-
447378
enum Foo {
448379
Bar,
449380
Baz,
450381
}
451382
452-
impl fmt::Debug for Foo {
453-
$0fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
383+
impl core::fmt::Debug for Foo {
384+
$0fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
454385
match self {
455386
Self::Bar => write!(f, "Bar"),
456387
Self::Baz => write!(f, "Baz"),

crates/test_utils/src/minicore.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
//! eq: sized
3232
//! ord: eq, option
3333
//! derive:
34+
//! fmt:
3435
3536
pub mod marker {
3637
// region:sized
@@ -334,6 +335,17 @@ pub mod cmp {
334335
}
335336
// endregion:eq
336337

338+
// region:fmt
339+
pub mod fmt {
340+
pub struct Error;
341+
pub type Result = Result<(), Error>;
342+
pub struct Formatter<'a>;
343+
pub trait Debug {
344+
fn fmt(&self, f: &mut Formatter<'_>) -> Result;
345+
}
346+
}
347+
// endregion:fmt
348+
337349
// region:slice
338350
pub mod slice {
339351
#[lang = "slice"]

0 commit comments

Comments
 (0)