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

Add macro-braces, disallowed-type and import-rename clippy lints #676

Merged
merged 2 commits into from Jul 22, 2021

Conversation

DevinR528
Copy link
Member

No description provided.

@DevinR528 DevinR528 requested a review from jplatte as a code owner July 20, 2021 22:52
@@ -958,6 +958,7 @@ fn get_plain_quote_fallback(original_message: &MessageEvent) -> String {
}
}

#[allow(clippy::nonstandard_macro_braces)]
Copy link
Member Author

Choose a reason for hiding this comment

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

This still has a few problems unfortunatly the format! is triggered because formatdoc! contains "format". I wonder if I should have done macro_name_to_check.starts_with(&format("{}!", name)

Copy link
Member

Choose a reason for hiding this comment

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

While I agree that's a bug, I also think we should use regular parentheses for formatdoc! (as we might already do in some places).

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you want me to add it to the list, I don't see anywhere where we don't use formatdoc!(..) but the point is catching errors in the future as much as clean up...

Copy link
Member

Choose a reason for hiding this comment

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

Do you want me to add it to the list

Sure.

I don't see anywhere where we don't use formatdoc!(..)

Then why did the lint fire?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because formatdoc! starts with format I opened another clippy fix PR rust-lang/rust-clippy@c1786d2

.clippy.toml Show resolved Hide resolved
enforced-import-renames = [ { path = "serde_json::Value", rename = "JsonValue" } ]
standard-macro-braces = [
{ name = "btreeset", brace = "[" },
# The macro calls itself like btreemap!(...) so this triggers for any use
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be nice if the lint didn't trigger on macro calls generated by other macro calls. Clippy often filters out code generated by macros by looking at the span AFAIK, maybe the same thing is possible here. And maybe the maplit crate would also accept a PR changing this (if they use hashmap with curly braces internally, why not btreemap?).

@@ -0,0 +1,10 @@
msrv = "1.50"
disallowed-types = []
Copy link
Member

Choose a reason for hiding this comment

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

This looks like a no-op, is this actually required? I thought Clippy doesn't do config inheritance.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not I just left it as a sorta reminder to add if someone could think of any? I'll get rid of it?

Copy link
Member

Choose a reason for hiding this comment

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

That's probably a good idea to have it as a reminder.

@jplatte jplatte merged commit 3101be1 into ruma:main Jul 22, 2021
@DevinR528 DevinR528 deleted the newlints branch July 23, 2021 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants