-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Remove allow(pedantic)
from formatter
#6549
Conversation
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
d88c086
to
01d0c1d
Compare
01d0c1d
to
008773a
Compare
PR Check ResultsEcosystem✅ ecosystem check detected no changes. BenchmarkLinux
Windows
|
7f83eeb
to
055af52
Compare
008773a
to
70c5ff5
Compare
055af52
to
8eb36fa
Compare
70c5ff5
to
206b837
Compare
206b837
to
301fe5c
Compare
lifetime: PhantomData, | ||
formatter: formatter::<F, Context>, | ||
} | ||
} | ||
|
||
/// Formats the value stored by this argument using the given formatter. | ||
#[allow(clippy::inline_always)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs says (https://rust-lang.github.io/rust-clippy/v0.0.212/index.html#inline_always):
While there are valid uses of this annotation (and once you know when to use it, by all means allow this lint), it’s a common newbie-mistake to pepper one’s code with it. As a rule of thumb, before slapping #[inline(always)] on a function, measure if that additional function call really affects your runtime profile sufficiently to make up for the increase in compile time.
Do we have measurements that #[inline(always)]
is better than #[inline]
?
err.type_id(), | ||
(*err).type_id(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know which rule triggered here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it was calling type_id
on Box<dyn >
Summary
This PR removes the module level
allow(pedantic)
from theruff_formatter
crate and fixes (or allows) the clippy violations.Why didn't we do this already? Computing the length of the input string required traversing the whole CST (nodes + tokens + trivia) in Rome. This by itself is much more expensive than resizing the buffer.
Test Plan
cargo test