Fix missing_panics_doc warning on unreachable!
.
This commit is contained in:
parent
4bbd7e46ee
commit
6c73f989e2
@ -1,6 +1,6 @@
|
||||
use crate::utils::{
|
||||
implements_trait, is_entrypoint_fn, is_type_diagnostic_item, match_panic_def_id, method_chain_args, return_ty,
|
||||
span_lint, span_lint_and_note,
|
||||
implements_trait, is_entrypoint_fn, is_expn_of, is_type_diagnostic_item, match_panic_def_id, method_chain_args,
|
||||
return_ty, span_lint, span_lint_and_note,
|
||||
};
|
||||
use if_chain::if_chain;
|
||||
use itertools::Itertools;
|
||||
@ -699,6 +699,7 @@ fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
|
||||
if let ExprKind::Path(QPath::Resolved(_, ref path)) = func_expr.kind;
|
||||
if let Some(path_def_id) = path.res.opt_def_id();
|
||||
if match_panic_def_id(self.cx, path_def_id);
|
||||
if is_expn_of(expr.span, "unreachable").is_none();
|
||||
then {
|
||||
self.panic_span = Some(expr.span);
|
||||
}
|
||||
|
@ -93,3 +93,8 @@ fn inner_body_private(opt: Option<u32>) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// This is okay because unreachable
|
||||
pub fn unreachable() {
|
||||
unreachable!("This function panics")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user