Remove rarely used type_size helper function

This commit is contained in:
Oliver Schneider
2018-02-09 14:22:41 +01:00
parent fc7b3955f8
commit 88970ec8cf
4 changed files with 12 additions and 19 deletions

View File

@@ -9,7 +9,6 @@ use rustc::lint::{LateContext, Level, Lint, LintContext};
use rustc::session::Session;
use rustc::traits;
use rustc::ty::{self, Ty, TyCtxt};
use rustc::ty::layout::LayoutOf;
use rustc_errors;
use std::borrow::Cow;
use std::env;
@@ -1048,12 +1047,6 @@ pub fn is_try(expr: &Expr) -> Option<&Expr> {
None
}
pub fn type_size<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx>) -> Option<u64> {
cx.layout_of(ty)
.ok()
.map(|layout| layout.size.bytes())
}
/// Returns true if the lint is allowed in the current context
///
/// Useful for skipping long running code when it's unnecessary