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

Handle relative paths in module_files lints #8611

Merged
merged 1 commit into from
Apr 2, 2022

Conversation

Alexendoo
Copy link
Member

The problem being that when clippy is run in the project's directory lp would be a relative path, this wasn't caught by the tests as there lp is an absolute path. Being a relative path it did not start with trim_src_path and so was ignored

Also allowed the removal of some .to_os_string/.to_owneds

changelog: Fixes [self_named_module_files] and [mod_module_files] not linting

Fixes #8123, cc @DevinR528

@rust-highfive
Copy link

r? @llogiq

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Mar 30, 2022
} else {
return;
};
let RealFileName::LocalPath(trim_to_src) = &cx.sess().opts.working_dir else { return };
Copy link
Contributor

Choose a reason for hiding this comment

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

Gotta love the new let-else stuff!

Copy link
Contributor

@DevinR528 DevinR528 left a comment

Choose a reason for hiding this comment

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

Not a Clippy contributor but I implemented the original lint, this looks good to me!

@llogiq
Copy link
Contributor

llogiq commented Apr 2, 2022

@DevinR528 as you wrote the original lint, you are a contributor. 😃

@Alexendoo this is a solid improvement, and the code is also looking good. Thank you for this!

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 2, 2022

📌 Commit 10a6d87 has been approved by llogiq

@bors
Copy link
Collaborator

bors commented Apr 2, 2022

⌛ Testing commit 10a6d87 with merge baaddf2...

@bors
Copy link
Collaborator

bors commented Apr 2, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: llogiq
Pushing baaddf2 to master...

@bors bors merged commit baaddf2 into rust-lang:master Apr 2, 2022
@Alexendoo Alexendoo deleted the module-files-relative-paths branch April 2, 2022 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mod_module_files does nothing
5 participants