diff options
| author | Philipp Krones <hello@philkrones.com> | 2022-09-09 13:36:26 +0200 |
|---|---|---|
| committer | Philipp Krones <hello@philkrones.com> | 2022-09-09 13:36:26 +0200 |
| commit | 98bf99e2f8cf8b357d63a67ce67d5fc5ceef8b3c (patch) | |
| tree | 9737ff22b257f29282e7538d9ecb264451a3c1c0 /src/docs/cmp_null.txt | |
| parent | 854f751b263dfac06dc3f635f8a9f92b8bc51da6 (diff) | |
| download | rust-98bf99e2f8cf8b357d63a67ce67d5fc5ceef8b3c.tar.gz rust-98bf99e2f8cf8b357d63a67ce67d5fc5ceef8b3c.zip | |
Merge commit 'b52fb5234cd7c11ecfae51897a6f7fa52e8777fc' into clippyup
Diffstat (limited to 'src/docs/cmp_null.txt')
| -rw-r--r-- | src/docs/cmp_null.txt | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/docs/cmp_null.txt b/src/docs/cmp_null.txt new file mode 100644 index 00000000000..02fd15124f0 --- /dev/null +++ b/src/docs/cmp_null.txt @@ -0,0 +1,23 @@ +### What it does +This lint checks for equality comparisons with `ptr::null` + +### Why is this bad? +It's easier and more readable to use the inherent +`.is_null()` +method instead + +### Example +``` +use std::ptr; + +if x == ptr::null { + // .. +} +``` + +Use instead: +``` +if x.is_null() { + // .. +} +``` \ No newline at end of file |
