mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
Add hook
This commit is contained in:
parent
e707447a86
commit
5bb768177e
@ -3865,7 +3865,9 @@ impl Methods {
|
|||||||
Some(("or", recv, [or_arg], or_span, _)) => {
|
Some(("or", recv, [or_arg], or_span, _)) => {
|
||||||
or_then_unwrap::check(cx, expr, recv, or_arg, or_span);
|
or_then_unwrap::check(cx, expr, recv, or_arg, or_span);
|
||||||
},
|
},
|
||||||
// unnecessary_literal_unwrap::check(cx, expr, recv);
|
Some((constructor @ "Some", _, _, _, _)) => {
|
||||||
|
unnecessary_literal_unwrap::check(cx, expr, recv, constructor);
|
||||||
|
}
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
unwrap_used::check(cx, expr, recv, false, self.allow_unwrap_in_tests);
|
unwrap_used::check(cx, expr, recv, false, self.allow_unwrap_in_tests);
|
||||||
|
@ -6,7 +6,7 @@ use rustc_span::sym;
|
|||||||
|
|
||||||
use super::UNNECESSARY_LITERAL_UNWRAP;
|
use super::UNNECESSARY_LITERAL_UNWRAP;
|
||||||
|
|
||||||
pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, recv: &hir::Expr<'_>) {
|
pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, recv: &hir::Expr<'_>, constructor: &str) {
|
||||||
let obj_ty = cx.typeck_results().expr_ty(recv).peel_refs();
|
let obj_ty = cx.typeck_results().expr_ty(recv).peel_refs();
|
||||||
|
|
||||||
let mess = if is_type_diagnostic_item(cx, obj_ty, sym::Option) {
|
let mess = if is_type_diagnostic_item(cx, obj_ty, sym::Option) {
|
||||||
|
Loading…
Reference in New Issue
Block a user