]> git.lizzy.rs Git - rust.git/blob - src/docs/inline_always.txt
Auto merge of #9421 - xphoniex:fix-#9420, r=giraffate
[rust.git] / src / docs / inline_always.txt
1 ### What it does
2 Checks for items annotated with `#[inline(always)]`,
3 unless the annotated function is empty or simply panics.
4
5 ### Why is this bad?
6 While there are valid uses of this annotation (and once
7 you know when to use it, by all means `allow` this lint), it's a common
8 newbie-mistake to pepper one's code with it.
9
10 As a rule of thumb, before slapping `#[inline(always)]` on a function,
11 measure if that additional function call really affects your runtime profile
12 sufficiently to make up for the increase in compile time.
13
14 ### Known problems
15 False positives, big time. This lint is meant to be
16 deactivated by everyone doing serious performance work. This means having
17 done the measurement.
18
19 ### Example
20 ```
21 #[inline(always)]
22 fn not_quite_hot_code(..) { ... }
23 ```