Skip to content

Conversation

@A4-Tacks
Copy link
Member

@A4-Tacks A4-Tacks commented Sep 2, 2025

Example

struct Foo;
impl Foo {
    $0fn foo() {}
    fn bar() {}$0
    fn baz() {}
}

Before this PR:

struct Foo;
impl Foo {
    mod modname {
        pub(crate) fn foo() {}

        pub(crate) fn bar() {}
    }
    fn baz() {}
}

After this PR:

struct Foo;
impl Foo {
    fn baz() {}
}
mod modname {
    use super::Foo;

    impl Foo {
        pub(crate) fn foo() {}

        pub(crate) fn bar() {}
    }
}

Example
---
```rust
struct Foo;
impl Foo {
    $0fn foo() {}
    fn bar() {}$0
    fn baz() {}
}
```

**Before this PR**:

```rust
struct Foo;
impl Foo {
    mod modname {
        pub(crate) fn foo() {}

        pub(crate) fn bar() {}
    }
    fn baz() {}
}
```

**After this PR**:

```rust
struct Foo;
impl Foo {
    fn baz() {}
}
mod modname {
    use super::Foo;

    impl Foo {
        pub(crate) fn foo() {}

        pub(crate) fn bar() {}
    }
}
```
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 2, 2025
Copy link
Member

@Veykril Veykril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Veykril Veykril added this pull request to the merge queue Oct 26, 2025
Merged via the queue into rust-lang:master with commit a23b393 Oct 26, 2025
15 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 26, 2025
@lnicola lnicola changed the title Fix extract multiple item in impl for extract_module fix: place new module outside impl block in extract_module Oct 26, 2025
@A4-Tacks A4-Tacks deleted the extract-mod-not-in-impl branch October 26, 2025 09:27
mendelsshop pushed a commit to mendelsshop/rust-analyzer that referenced this pull request Oct 27, 2025
Fix extract multiple item in impl for extract_module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants