File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -1330,11 +1330,21 @@ declare_clippy_lint! {
1330
1330
}
1331
1331
1332
1332
declare_clippy_lint ! {
1333
- /// **What it does:** Looks for unnecessary lazily evaluated closures on `Option` and `Result`.
1333
+ /// **What it does:** As the counterpart to `or_fun_call`, this lint looks for unnecessary
1334
+ /// lazily evaluated closures on `Option` and `Result`.
1335
+ ///
1336
+ /// This lint suggests changing the following functions, when eager evaluation results in
1337
+ /// simpler code:
1338
+ /// - `unwrap_or_else` to `unwrap_or`
1339
+ /// - `and_then` to `and`
1340
+ /// - `or_else` to `or`
1341
+ /// - `get_or_insert_with` to `get_or_insert`
1342
+ /// - `ok_or_else` to `ok_or`
1334
1343
///
1335
1344
/// **Why is this bad?** Using eager evaluation is shorter and simpler in some cases.
1336
1345
///
1337
- /// **Known problems:** None.
1346
+ /// **Known problems:** It is possible, but not recommended for `Deref` and `Index` to have
1347
+ /// side effects. Eagerly evaluating them can change the semantics of the program.
1338
1348
///
1339
1349
/// **Example:**
1340
1350
///
You can’t perform that action at this time.
0 commit comments