summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/mismatched_target_os.txt
blob: 51e5ec6e7c5c4c7ad8ccc3016e6064bf07d4dcdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
### What it does
Checks for cfg attributes having operating systems used in target family position.

### Why is this bad?
The configuration option will not be recognised and the related item will not be included
by the conditional compilation engine.

### Example
```
#[cfg(linux)]
fn conditional() { }
```

Use instead:
```
#[cfg(target_os = "linux")]
fn conditional() { }

// or

#[cfg(unix)]
fn conditional() { }
```
Check the [Rust Reference](https://doc.rust-lang.org/reference/conditional-compilation.html#target_os) for more details.