@@ -150,6 +150,7 @@ macro_rules! extract_msrv_attr {
150
150
151
151
/// If the given expression is a local binding, find the initializer expression.
152
152
/// If that initializer expression is another local binding, find its initializer again.
153
+ ///
153
154
/// This process repeats as long as possible (but usually no more than once). Initializer
154
155
/// expressions with adjustments are ignored. If this is not desired, use [`find_binding_init`]
155
156
/// instead.
@@ -180,6 +181,7 @@ pub fn expr_or_init<'a, 'b, 'tcx: 'b>(cx: &LateContext<'tcx>, mut expr: &'a Expr
180
181
}
181
182
182
183
/// Finds the initializer expression for a local binding. Returns `None` if the binding is mutable.
184
+ ///
183
185
/// By only considering immutable bindings, we guarantee that the returned expression represents the
184
186
/// value of the binding wherever it is referenced.
185
187
///
@@ -428,12 +430,12 @@ pub fn qpath_generic_tys<'tcx>(qpath: &QPath<'tcx>) -> impl Iterator<Item = &'tc
428
430
} )
429
431
}
430
432
431
- /// THIS METHOD IS DEPRECATED and will eventually be removed since it does not match against the
433
+ /// THIS METHOD IS DEPRECATED. Matches a `QPath` against a slice of segment string literals.
434
+ ///
435
+ /// This method is deprecated and will eventually be removed since it does not match against the
432
436
/// entire path or resolved `DefId`. Prefer using `match_def_path`. Consider getting a `DefId` from
433
437
/// `QPath::Resolved.1.res.opt_def_id()`.
434
438
///
435
- /// Matches a `QPath` against a slice of segment string literals.
436
- ///
437
439
/// There is also `match_path` if you are dealing with a `rustc_hir::Path` instead of a
438
440
/// `rustc_hir::QPath`.
439
441
///
@@ -482,12 +484,12 @@ pub fn is_path_diagnostic_item<'tcx>(
482
484
path_def_id ( cx, maybe_path) . map_or ( false , |id| cx. tcx . is_diagnostic_item ( diag_item, id) )
483
485
}
484
486
485
- /// THIS METHOD IS DEPRECATED and will eventually be removed since it does not match against the
487
+ /// THIS METHOD IS DEPRECATED. Matches a `Path` against a slice of segment string literals.
488
+ ///
489
+ /// This method is deprecated and will eventually be removed since it does not match against the
486
490
/// entire path or resolved `DefId`. Prefer using `match_def_path`. Consider getting a `DefId` from
487
491
/// `QPath::Resolved.1.res.opt_def_id()`.
488
492
///
489
- /// Matches a `Path` against a slice of segment string literals.
490
- ///
491
493
/// There is also `match_qpath` if you are dealing with a `rustc_hir::QPath` instead of a
492
494
/// `rustc_hir::Path`.
493
495
///
@@ -903,6 +905,7 @@ pub fn is_default_equivalent_call(cx: &LateContext<'_>, repl_func: &Expr<'_>) ->
903
905
}
904
906
905
907
/// Returns true if the expr is equal to `Default::default()` of it's type when evaluated.
908
+ ///
906
909
/// It doesn't cover all cases, for example indirect function calls (some of std
907
910
/// functions are supported) but it is the best we have.
908
911
pub fn is_default_equivalent ( cx : & LateContext < ' _ > , e : & Expr < ' _ > ) -> bool {
@@ -1057,6 +1060,7 @@ impl std::ops::BitOrAssign for CaptureKind {
1057
1060
}
1058
1061
1059
1062
/// Given an expression referencing a local, determines how it would be captured in a closure.
1063
+ ///
1060
1064
/// Note as this will walk up to parent expressions until the capture can be determined it should
1061
1065
/// only be used while making a closure somewhere a value is consumed. e.g. a block, match arm, or
1062
1066
/// function argument (other than a receiver).
@@ -2359,8 +2363,9 @@ pub fn fn_def_id_with_node_args<'tcx>(
2359
2363
}
2360
2364
2361
2365
/// Returns `Option<String>` where String is a textual representation of the type encapsulated in
2362
- /// the slice iff the given expression is a slice of primitives (as defined in the
2363
- /// `is_recursively_primitive_type` function) and `None` otherwise.
2366
+ /// the slice iff the given expression is a slice of primitives.
2367
+ ///
2368
+ /// (As defined in the `is_recursively_primitive_type` function.) Returns `None` otherwise.
2364
2369
pub fn is_slice_of_primitives ( cx : & LateContext < ' _ > , expr : & Expr < ' _ > ) -> Option < String > {
2365
2370
let expr_type = cx. typeck_results ( ) . expr_ty_adjusted ( expr) ;
2366
2371
let expr_kind = expr_type. kind ( ) ;
0 commit comments