diff options
| author | Devon Hollowood <devonhollowood@gmail.com> | 2018-10-07 17:05:28 -0700 |
|---|---|---|
| committer | Devon Hollowood <devonhollowood@gmail.com> | 2018-10-07 17:09:32 -0700 |
| commit | 6528749083bb64a28aca6a8be2bf67458ce62147 (patch) | |
| tree | 6d79a6806926aaa80a1ba7e4aac90aedf3687180 | |
| parent | 87f6d9e7f94af1e2c192a68c997e6b247bba5d06 (diff) | |
| download | rust-6528749083bb64a28aca6a8be2bf67458ce62147.tar.gz rust-6528749083bb64a28aca6a8be2bf67458ce62147.zip | |
Fix items_after_statements for `use` statements
| -rw-r--r-- | clippy_lints/src/consts.rs | 4 | ||||
| -rw-r--r-- | clippy_lints/src/write.rs | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/clippy_lints/src/consts.rs b/clippy_lints/src/consts.rs index 4e09e039100..3cf38440744 100644 --- a/clippy_lints/src/consts.rs +++ b/clippy_lints/src/consts.rs @@ -265,6 +265,8 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> { /// lookup a possibly constant expression from a ExprKind::Path fn fetch_path(&mut self, qpath: &QPath, id: HirId) -> Option<Constant> { + use crate::rustc::mir::interpret::GlobalId; + let def = self.tables.qpath_def(qpath, id); match def { Def::Const(def_id) | Def::AssociatedConst(def_id) => { @@ -279,7 +281,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> { instance, promoted: None, }; - use crate::rustc::mir::interpret::GlobalId; + let result = self.tcx.const_eval(self.param_env.and(gid)).ok()?; let ret = miri_to_const(self.tcx, result); if ret.is_some() { diff --git a/clippy_lints/src/write.rs b/clippy_lints/src/write.rs index a367a04b2ba..06575a264b3 100644 --- a/clippy_lints/src/write.rs +++ b/clippy_lints/src/write.rs @@ -246,6 +246,7 @@ impl EarlyLintPass for Pass { } fn check_tts<'a>(cx: &EarlyContext<'a>, tts: &ThinTokenStream, is_write: bool) -> (Option<String>, Option<Expr>) { + use crate::fmt_macros::*; let tts = TokenStream::from(tts.clone()); let mut parser = parser::Parser::new(&cx.sess.parse_sess, tts, None, false, false); let mut expr: Option<Expr> = None; @@ -264,7 +265,6 @@ fn check_tts<'a>(cx: &EarlyContext<'a>, tts: &ThinTokenStream, is_write: bool) - Ok(token) => token.0.to_string(), Err(_) => return (None, expr), }; - use crate::fmt_macros::*; let tmp = fmtstr.clone(); let mut args = vec![]; let mut fmt_parser = Parser::new(&tmp, None); |
