@@ -140,18 +140,19 @@ pub(crate) const DEFAULT_NONFALLIBLE_PATHS: &[&str] =
140
140
141
141
#[ derive( Clone , Debug , PartialEq , Eq , Deserialize , Serialize ) ]
142
142
pub struct TestWithoutFailCaseBehaviour {
143
- /// Indexing into a slice is fallible, and thus the a test that is doing that
144
- /// can fail. If set true, the lint consider indexing into a slice a failable case
143
+ /// Indexing is fallible, and thus the a test that is doing that can fail.
144
+ ///
145
+ /// If set true, the lint consider indexing into a slice a failable case
145
146
/// and won't lint tests that has some sort of indexing. This analysis still done
146
147
/// in a interfunctional manner. Meaning that any indexing opeartion done inside of
147
148
/// a function that the test calls will still mark the test fallible.
148
149
///
149
- /// By default this is set to `false`. That is becuase from a usability perspective,
150
+ /// By default this is set to `false`. That is because from a usability perspective,
150
151
/// indexing an array is not the intended way to fail a test. So setting this `true`
151
152
/// reduces false positives but makes the analysis more focused on possible byproducts
152
153
/// of a test. That is the set of operations to get the point we assert something rather
153
154
/// than the existance of asserting that thing.
154
- pub include_slice_indexing : bool ,
155
+ pub include_indexing : bool ,
155
156
/// List of full paths of macros and functions, that can fail. If a test, or a function
156
157
/// that the test calls contains any one of these macros, we will mark the test fallible.
157
158
/// By default this macros are defined as `assert!`, `assert_eq!`, `panic!`.
@@ -163,20 +164,10 @@ pub struct TestWithoutFailCaseBehaviour {
163
164
pub non_fallible_paths : Vec < String > ,
164
165
}
165
166
166
- impl TestWithoutFailCaseBehaviour {
167
- pub fn new ( include_slice_indexing : bool , fallible_paths : Vec < String > , non_fallible_paths : Vec < String > ) -> Self {
168
- Self {
169
- include_slice_indexing,
170
- fallible_paths,
171
- non_fallible_paths,
172
- }
173
- }
174
- }
175
-
176
167
impl Default for TestWithoutFailCaseBehaviour {
177
168
fn default ( ) -> Self {
178
169
Self {
179
- include_slice_indexing : false ,
170
+ include_indexing : false ,
180
171
fallible_paths : DEFAULT_FALLIBLE_PATHS . iter ( ) . map ( |s| s. to_string ( ) ) . collect ( ) ,
181
172
non_fallible_paths : DEFAULT_NONFALLIBLE_PATHS . iter ( ) . map ( |a| a. to_string ( ) ) . collect ( ) ,
182
173
}
0 commit comments