Commit 4a507dc
[Guideline] Add safe division guideline to avoid dividing by zero (rustfoundation#136)
* Add checked arithmetic guidelines
* Add more typo ignore patterns
These correspond to the unique ID's for each section.
* Remove floating point types from these guidelines
* Ensure example match
* Add statement to rationale justifying the Advisory
* Correct typos
* Update comment for directive typo check
Co-authored-by: Pete LeVasseur <plevasseur@gmail.com>
* Expound upon `unchecked_` functions
Additionally the code block formatting was updating, and a link was added.
Co-authored-by: Pete LeVasseur <plevasseur@gmail.com>
* Fix grammar of wrap around
* Change sphinx link syntax
* Add link to FLS ArithmeticExpression
* Correct description of unchecked function
As pointed out, they result in UB not necessarily panics
* Remove other mention of panics
* Narrow guideline to just integer division.
* Remove guideline on unchecked methods
As those are marked unsafe anyway
* Add remainder expression example
* Downgrade this to an advisory guideline
It could get annoying in existing codebases
* Fix missing commas for syntax
* Add subset tag
* Word choice as suggested by Felix
* Formatting
* Apply suggestions from code review
Spelling and word choice from review
Co-authored-by: Félix Fischer <felix91gr@users.noreply.github.com>
* Example clarification from code review
Co-authored-by: Félix Fischer <felix91gr@users.noreply.github.com>
* Note clarity and rewording
Co-authored-by: Félix Fischer <felix91gr@users.noreply.github.com>
---------
Co-authored-by: Pete LeVasseur <plevasseur@gmail.com>
Co-authored-by: Félix Fischer <felix91gr@users.noreply.github.com>1 parent f4b4f89 commit 4a507dc
2 files changed
+68
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
85 | 149 | | |
86 | 150 | | |
87 | 151 | | |
| |||
0 commit comments