Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INSP: attach module without a parent to a parent module in AttachFileToModuleFix #5766

Merged
merged 1 commit into from
Jul 29, 2020

Conversation

Kobzol
Copy link
Member

@Kobzol Kobzol commented Jul 20, 2020

#5490 added a quick fix to attach a file to a nearby module. However, for mod.rs files it offered only crate root files (lib.rs, main.rs) and not parent modules. So in this case:

//- foo/mod.rs
/* nothing to see here */
//- foo/bar/mod.rs
/* caret*/

The quick fix wasn't offered at /*caret*/.

After this PR, the quick fix is offered and the example code is transformed into this:

//- foo/mod.rs
mod bar;
//- foo/bar/mod.rs

@Kobzol Kobzol added the fix Pull requests that fix some bug(s) label Jul 20, 2020
Copy link
Member

@mchernyavsky mchernyavsky left a comment

Choose a reason for hiding this comment

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

Thanks!

bors r+

@mchernyavsky mchernyavsky added this to the v128 milestone Jul 28, 2020
@mchernyavsky mchernyavsky self-assigned this Jul 28, 2020
bors bot added a commit that referenced this pull request Jul 28, 2020
5660: COMP: offer only struct fields in struct pat r=mchernyavsky a=Kobzol

This PR filters out unnecessary completions offered in struct pats.
It also adds `..` to completion, but I'm not sure if that's the right way to do it, so it's in a separate commit.

Fixes third part of #4448

5766: INSP: attach module without a parent to a parent module in AttachFileToModuleFix r=mchernyavsky a=Kobzol

#5490 added a quick fix to attach a file to a nearby module. However, for `mod.rs` files it offered only crate root files (`lib.rs`, `main.rs`) and not parent modules. So in this case:

```rust
//- foo/mod.rs
/* nothing to see here */
//- foo/bar/mod.rs
/* caret*/
```
The quick fix wasn't offered at `/*caret*/`.

After this PR, the quick fix is offered and the example code is transformed into this:

```rust
//- foo/mod.rs
mod bar;
//- foo/bar/mod.rs
```

5811: INSP: add support for trait refs in RsWrongTypeArgumentsNumberInspection r=undin a=Kobzol

`RsWrongTypeArgumentsNumberInspection` previously did not work for trait refs, for example `dyn Trait` or `impl Trait`. This PR adds support for these cases.

TODO:
- [x] run `RsRealProjectAnalysisTest`

5816: Refactoring of auto-import related code r=mchernyavsky a=Undin

These changes extract auto-import related code from `AutoImportFix` into `org.rust.ide.utils.import` package since this code widely used in different IDE features.
Also, this code is split into several separate files

As a result, a lot of code doesn't depend on `AutoImportFix`


5819: REF: add unsafe modifier to functions extracted from unsafe functions r=mchernyavsky a=Kobzol

This PR adds `unsafe` to functions extracted from `unsafe` functions. Currently the `unsafe` is added unconditionally, should I improve that?

The extracted statements would have to be scanned for unsafe operations that are not inside an `unsafe` block. Since pretty much the same code is already in `RsUnsafeExpressionAnnotator`, it should be refactored somehow to share the logic.

Fixes: #5814

Co-authored-by: Jakub Beránek <berykubik@gmail.com>
Co-authored-by: Arseniy Pendryak <a.pendryak@yandex.ru>
@bors
Copy link
Contributor

bors bot commented Jul 29, 2020

Build failed (retrying...):

  • check

bors bot added a commit that referenced this pull request Jul 29, 2020
5660: COMP: offer only struct fields in struct pat r=mchernyavsky a=Kobzol

This PR filters out unnecessary completions offered in struct pats.
It also adds `..` to completion, but I'm not sure if that's the right way to do it, so it's in a separate commit.

Fixes third part of #4448

5766: INSP: attach module without a parent to a parent module in AttachFileToModuleFix r=mchernyavsky a=Kobzol

#5490 added a quick fix to attach a file to a nearby module. However, for `mod.rs` files it offered only crate root files (`lib.rs`, `main.rs`) and not parent modules. So in this case:

```rust
//- foo/mod.rs
/* nothing to see here */
//- foo/bar/mod.rs
/* caret*/
```
The quick fix wasn't offered at `/*caret*/`.

After this PR, the quick fix is offered and the example code is transformed into this:

```rust
//- foo/mod.rs
mod bar;
//- foo/bar/mod.rs
```

Co-authored-by: Jakub Beránek <berykubik@gmail.com>
@bors
Copy link
Contributor

bors bot commented Jul 29, 2020

Build failed (retrying...):

  • check

@bors
Copy link
Contributor

bors bot commented Jul 29, 2020

Build succeeded:

@bors bors bot merged commit 5e51a16 into intellij-rust:master Jul 29, 2020
@Kobzol Kobzol deleted the insp-attach-mod-to-parent-mod branch July 29, 2020 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Pull requests that fix some bug(s)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants