diff options
Diffstat (limited to '')
-rw-r--r-- | src/tools/clippy/src/docs/mismatched_target_os.txt | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/mismatched_target_os.txt b/src/tools/clippy/src/docs/mismatched_target_os.txt new file mode 100644 index 000000000..51e5ec6e7 --- /dev/null +++ b/src/tools/clippy/src/docs/mismatched_target_os.txt @@ -0,0 +1,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.
\ No newline at end of file |