Commit fe26933 1 parent ce661e3 commit fe26933 Copy full SHA for fe26933
File tree 4 files changed +7
-16
lines changed
4 files changed +7
-16
lines changed Original file line number Diff line number Diff line change 1
- extern crate rustc_errors;
2
-
3
1
use rustc_errors:: Applicability ;
4
2
use rustc_hir:: { Expr , ExprKind } ;
5
3
use rustc_lint:: { LateContext , LateLintPass , LintContext } ;
Original file line number Diff line number Diff line change 1
- extern crate rustc_errors;
2
-
3
1
use rustc_errors:: Applicability ;
4
2
use rustc_hir:: { BinOpKind , Expr , ExprKind } ;
5
3
use rustc_lint:: { LateContext , LateLintPass , LintContext } ;
Original file line number Diff line number Diff line change 1
- extern crate rustc_errors;
2
-
3
1
use rustc_errors:: Applicability ;
4
2
use rustc_hir:: { Expr , ExprKind } ;
5
3
use rustc_lint:: { LateContext , LateLintPass , LintContext } ;
Original file line number Diff line number Diff line change 1
1
use rustc_hir:: { ItemKind , UseKind } ;
2
2
use rustc_lint:: { LateContext , LateLintPass , LintContext } ;
3
3
use rustc_session:: { declare_lint, declare_lint_pass} ;
4
- use rustc_span:: Span ;
4
+ use rustc_span:: { FileName , FileNameDisplayPreference , Span } ;
5
5
6
6
declare_lint ! {
7
7
/// ### What it does
@@ -30,19 +30,16 @@ declare_lint_pass!(RayonImport => [RAYON_IMPORT]);
30
30
impl LateLintPass < ' _ > for RayonImport {
31
31
fn check_crate ( & mut self , cx : & LateContext < ' _ > ) {
32
32
// Skip linting if in build.rs file
33
- if cx
33
+ if let FileName :: Real ( f ) = cx
34
34
. sess ( )
35
35
. source_map ( )
36
36
. span_to_filename ( cx. tcx . hir ( ) . root_module ( ) . spans . inner_span )
37
- . is_real ( )
38
- && cx
39
- . sess ( )
40
- . source_map ( )
41
- . span_to_filename ( cx. tcx . hir ( ) . root_module ( ) . spans . inner_span )
42
- . to_string ( )
43
- . ends_with ( "build.rs" )
44
37
{
45
- return ;
38
+ if f. to_string_lossy ( FileNameDisplayPreference :: Short )
39
+ . ends_with ( "build.rs" )
40
+ {
41
+ return ;
42
+ }
46
43
}
47
44
48
45
let mut found_rayon_prelude = false ;
You can’t perform that action at this time.
0 commit comments