Remove #[inline] from generic functions in core::range#155420
Remove #[inline] from generic functions in core::range#155420tbu- wants to merge 1 commit intorust-lang:mainfrom
#[inline] from generic functions in core::range#155420Conversation
They shouldn't be needed according to https://std-dev-guide.rust-lang.org/policy/inline.html.
|
r? @jhpratt rustbot has assigned @jhpratt. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
☔ The latest upstream changes (presumably #155416) made this pull request unmergeable. Please resolve the merge conflicts. |
| /// assert!(!Range::from(0.0..f32::NAN).contains(&0.5)); | ||
| /// assert!(!Range::from(f32::NAN..1.0).contains(&0.5)); | ||
| /// ``` | ||
| #[inline] |
There was a problem hiding this comment.
I know that the Rust stdlibs dev guide tells you that you shouldn't need to #[inline] methods that have generics involved, but I do see that the previous Range types inline for methods like these.
Unsure if this would cause performance regression and if the rust compiler inlines this automatically without this attribute.
|
While I believe you're correct, having the attribute present doesn't harm anything and is clearer to anyone reading the code. |
|
@jhpratt Should the dev guide be updated so it doesn't recommend me to do this? |
|
I don't see anything saying the attribute should be actively removed, only that it's not necessary on a technical level. Feel free to bring it up in Zulip if you'd like; I don't feel strongly about this. |
They shouldn't be needed according to https://std-dev-guide.rust-lang.org/policy/inline.html.