]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/src/docs/mismatched_target_os.txt
Auto merge of #98559 - jackh726:remove-reempty, r=oli-obk
[rust.git] / src / tools / clippy / src / docs / mismatched_target_os.txt
1 ### What it does
2 Checks for cfg attributes having operating systems used in target family position.
3
4 ### Why is this bad?
5 The configuration option will not be recognised and the related item will not be included
6 by the conditional compilation engine.
7
8 ### Example
9 ```
10 #[cfg(linux)]
11 fn conditional() { }
12 ```
13
14 Use instead:
15 ```
16 #[cfg(target_os = "linux")]
17 fn conditional() { }
18
19 // or
20
21 #[cfg(unix)]
22 fn conditional() { }
23 ```
24 Check the [Rust Reference](https://doc.rust-lang.org/reference/conditional-compilation.html#target_os) for more details.