mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-02 15:56:09 +03:00
Merge pull request #791 from Jascha-N/fix-fnkind-pattern
Match attributes in FnKind patterns
This commit is contained in:
+1
-1
@@ -39,7 +39,7 @@ fn get_lints(&self) -> LintArray {
|
||||
|
||||
impl LateLintPass for TopLevelRefPass {
|
||||
fn check_fn(&mut self, cx: &LateContext, k: FnKind, decl: &FnDecl, _: &Block, _: Span, _: NodeId) {
|
||||
if let FnKind::Closure = k {
|
||||
if let FnKind::Closure(_) = k {
|
||||
// Does not apply to closures
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ fn check_fn(&mut self, cx: &LateContext, kind: FnKind, decl: &hir::FnDecl, _: &h
|
||||
return;
|
||||
}
|
||||
|
||||
if let FnKind::Method(name, _, _) = kind {
|
||||
if let FnKind::Method(name, _, _, _) = kind {
|
||||
if decl.inputs.is_empty() && name.as_str() == "new" {
|
||||
let self_ty = cx.tcx.lookup_item_type(cx.tcx.map.local_def_id(cx.tcx.map.get_parent(id))).ty;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user