diff options
Diffstat (limited to 'src/docs/manual_assert.txt')
| -rw-r--r-- | src/docs/manual_assert.txt | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/src/docs/manual_assert.txt b/src/docs/manual_assert.txt deleted file mode 100644 index 93653081a2c..00000000000 --- a/src/docs/manual_assert.txt +++ /dev/null @@ -1,18 +0,0 @@ -### What it does -Detects `if`-then-`panic!` that can be replaced with `assert!`. - -### Why is this bad? -`assert!` is simpler than `if`-then-`panic!`. - -### Example -``` -let sad_people: Vec<&str> = vec![]; -if !sad_people.is_empty() { - panic!("there are sad people: {:?}", sad_people); -} -``` -Use instead: -``` -let sad_people: Vec<&str> = vec![]; -assert!(sad_people.is_empty(), "there are sad people: {:?}", sad_people); -``` \ No newline at end of file |
