Make new_without_default ignore const fns; fixes #977
This commit is contained in:
parent
d7df882fa0
commit
bf4ce86e9e
2 changed files with 11 additions and 2 deletions
|
|
@ -95,7 +95,11 @@ impl LateLintPass for NewWithoutDefault {
|
|||
return;
|
||||
}
|
||||
|
||||
if let FnKind::Method(name, _, _, _) = kind {
|
||||
if let FnKind::Method(name, ref sig, _, _) = kind {
|
||||
if sig.constness == hir::Constness::Const {
|
||||
// can't be implemented by default
|
||||
return;
|
||||
}
|
||||
if decl.inputs.is_empty() && name.as_str() == "new" &&
|
||||
cx.access_levels.is_reachable(id) {
|
||||
let self_ty = cx.tcx.lookup_item_type(cx.tcx.map.local_def_id(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue