@@ -140,18 +140,19 @@ pub(crate) const DEFAULT_NONFALLIBLE_PATHS: &[&str] =
140140
141141#[ derive( Clone , Debug , PartialEq , Eq , Deserialize , Serialize ) ]
142142pub 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
145146 /// and won't lint tests that has some sort of indexing. This analysis still done
146147 /// in a interfunctional manner. Meaning that any indexing opeartion done inside of
147148 /// a function that the test calls will still mark the test fallible.
148149 ///
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,
150151 /// indexing an array is not the intended way to fail a test. So setting this `true`
151152 /// reduces false positives but makes the analysis more focused on possible byproducts
152153 /// of a test. That is the set of operations to get the point we assert something rather
153154 /// than the existance of asserting that thing.
154- pub include_slice_indexing : bool ,
155+ pub include_indexing : bool ,
155156 /// List of full paths of macros and functions, that can fail. If a test, or a function
156157 /// that the test calls contains any one of these macros, we will mark the test fallible.
157158 /// By default this macros are defined as `assert!`, `assert_eq!`, `panic!`.
@@ -163,20 +164,10 @@ pub struct TestWithoutFailCaseBehaviour {
163164 pub non_fallible_paths : Vec < String > ,
164165}
165166
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-
176167impl Default for TestWithoutFailCaseBehaviour {
177168 fn default ( ) -> Self {
178169 Self {
179- include_slice_indexing : false ,
170+ include_indexing : false ,
180171 fallible_paths : DEFAULT_FALLIBLE_PATHS . iter ( ) . map ( |s| s. to_string ( ) ) . collect ( ) ,
181172 non_fallible_paths : DEFAULT_NONFALLIBLE_PATHS . iter ( ) . map ( |a| a. to_string ( ) ) . collect ( ) ,
182173 }
0 commit comments