Skip to content

Commit 6528749

Browse files
Fix items_after_statements for use statements
1 parent 87f6d9e commit 6528749

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

clippy_lints/src/consts.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
265265

266266
/// lookup a possibly constant expression from a ExprKind::Path
267267
fn fetch_path(&mut self, qpath: &QPath, id: HirId) -> Option<Constant> {
268+
use crate::rustc::mir::interpret::GlobalId;
269+
268270
let def = self.tables.qpath_def(qpath, id);
269271
match def {
270272
Def::Const(def_id) | Def::AssociatedConst(def_id) => {
@@ -279,7 +281,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
279281
instance,
280282
promoted: None,
281283
};
282-
use crate::rustc::mir::interpret::GlobalId;
284+
283285
let result = self.tcx.const_eval(self.param_env.and(gid)).ok()?;
284286
let ret = miri_to_const(self.tcx, result);
285287
if ret.is_some() {

clippy_lints/src/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ impl EarlyLintPass for Pass {
246246
}
247247

248248
fn check_tts<'a>(cx: &EarlyContext<'a>, tts: &ThinTokenStream, is_write: bool) -> (Option<String>, Option<Expr>) {
249+
use crate::fmt_macros::*;
249250
let tts = TokenStream::from(tts.clone());
250251
let mut parser = parser::Parser::new(&cx.sess.parse_sess, tts, None, false, false);
251252
let mut expr: Option<Expr> = None;
@@ -264,7 +265,6 @@ fn check_tts<'a>(cx: &EarlyContext<'a>, tts: &ThinTokenStream, is_write: bool) -
264265
Ok(token) => token.0.to_string(),
265266
Err(_) => return (None, expr),
266267
};
267-
use crate::fmt_macros::*;
268268
let tmp = fmtstr.clone();
269269
let mut args = vec![];
270270
let mut fmt_parser = Parser::new(&tmp, None);

0 commit comments

Comments
 (0)