mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
Fix items_after_statements for use
statements
This commit is contained in:
parent
87f6d9e7f9
commit
6528749083
2 changed files with 4 additions and 2 deletions
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue