Merge remote-tracking branch 'upstream/master' into sync-from-rust
This commit is contained in:
commit
da86067775
23 changed files with 629 additions and 62 deletions
|
|
@ -899,7 +899,7 @@ pub fn is_ctor_or_promotable_const_function(cx: &LateContext<'_>, expr: &Expr<'_
|
|||
return match res {
|
||||
def::Res::Def(DefKind::Variant | DefKind::Ctor(..), ..) => true,
|
||||
// FIXME: check the constness of the arguments, see https://github.com/rust-lang/rust-clippy/pull/5682#issuecomment-638681210
|
||||
def::Res::Def(DefKind::Fn, def_id) if has_no_arguments(cx, def_id) => {
|
||||
def::Res::Def(DefKind::Fn | DefKind::AssocFn, def_id) if has_no_arguments(cx, def_id) => {
|
||||
const_eval::is_const_fn(cx.tcx, def_id)
|
||||
},
|
||||
def::Res::Def(_, def_id) => cx.tcx.is_promotable_const_fn(def_id),
|
||||
|
|
|
|||
|
|
@ -132,7 +132,11 @@ impl<'a> Sugg<'a> {
|
|||
pub fn ast(cx: &EarlyContext<'_>, expr: &ast::Expr, default: &'a str) -> Self {
|
||||
use rustc_ast::ast::RangeLimits;
|
||||
|
||||
let snippet = snippet(cx, expr.span, default);
|
||||
let snippet = if expr.span.from_expansion() {
|
||||
snippet_with_macro_callsite(cx, expr.span, default)
|
||||
} else {
|
||||
snippet(cx, expr.span, default)
|
||||
};
|
||||
|
||||
match expr.kind {
|
||||
ast::ExprKind::AddrOf(..)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue