File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,9 @@ impl EarlyLintPass for UnusedUnit {
4747 if_chain ! {
4848 if let Some ( stmt) = block. stmts. last( ) ;
4949 if let ast:: StmtKind :: Expr ( ref expr) = stmt. kind;
50- if is_unit_expr( expr) && !stmt. span. from_expansion( ) ;
50+ if is_unit_expr( expr) ;
51+ let ctxt = block. span. ctxt( ) ;
52+ if stmt. span. ctxt( ) == ctxt && expr. span. ctxt( ) == ctxt;
5153 then {
5254 let sp = expr. span;
5355 span_lint_and_sugg(
Original file line number Diff line number Diff line change @@ -80,3 +80,10 @@ fn test2(){}
8080
8181#[rustfmt::skip]
8282fn test3(){}
83+
84+ fn macro_expr() {
85+ macro_rules! e {
86+ () => (());
87+ }
88+ e!()
89+ }
Original file line number Diff line number Diff line change @@ -80,3 +80,10 @@ fn test2() ->(){}
8080
8181#[ rustfmt:: skip]
8282fn test3 ( ) -> ( ) { }
83+
84+ fn macro_expr ( ) {
85+ macro_rules! e {
86+ ( ) => ( ( ) ) ;
87+ }
88+ e ! ( )
89+ }
You can’t perform that action at this time.
0 commit comments