File tree Expand file tree Collapse file tree 3 files changed +45
-16
lines changed
tests/testsuite/lints/implicit_features/edition_2021_warn Expand file tree Collapse file tree 3 files changed +45
-16
lines changed Original file line number Diff line number Diff line change @@ -192,21 +192,18 @@ pub fn check_implicit_features(
192
192
if lint_level == LintLevel :: Forbid || lint_level == LintLevel :: Deny {
193
193
* error_count += 1 ;
194
194
}
195
+ let mut toml_path = vec ! [ dep. kind( ) . kind_table( ) , dep_name_in_toml. as_str( ) ] ;
196
+ let platform = dep. platform ( ) . map ( |p| p. to_string ( ) ) ;
197
+ if let Some ( platform) = platform. as_ref ( ) {
198
+ toml_path. insert ( 0 , platform) ;
199
+ toml_path. insert ( 0 , "target" ) ;
200
+ }
195
201
let level = lint_level. to_diagnostic_level ( ) ;
196
202
let manifest_path = rel_cwd_manifest_path ( path, gctx) ;
197
203
let message = level. title ( IMPLICIT_FEATURES . desc ) . snippet (
198
204
Snippet :: source ( manifest. contents ( ) )
199
205
. origin ( & manifest_path)
200
- . annotation (
201
- level. span (
202
- get_span (
203
- manifest. document ( ) ,
204
- & [ "dependencies" , & dep_name_in_toml] ,
205
- false ,
206
- )
207
- . unwrap ( ) ,
208
- ) ,
209
- )
206
+ . annotation ( level. span ( get_span ( manifest. document ( ) , & toml_path, false ) . unwrap ( ) ) )
210
207
. fold ( true ) ,
211
208
) ;
212
209
let renderer = Renderer :: styled ( ) . term_width (
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ use cargo_test_support::{file, project};
6
6
#[ cargo_test]
7
7
fn case ( ) {
8
8
Package :: new ( "bar" , "0.1.0" ) . publish ( ) ;
9
+ Package :: new ( "baz" , "0.1.0" ) . publish ( ) ;
10
+ Package :: new ( "target-dep" , "0.1.0" ) . publish ( ) ;
9
11
let p = project ( )
10
12
. file (
11
13
"Cargo.toml" ,
@@ -18,6 +20,12 @@ edition = "2021"
18
20
[dependencies]
19
21
bar = { version = "0.1.0", optional = true }
20
22
23
+ [build-dependencies]
24
+ baz = { version = "0.1.0", optional = true }
25
+
26
+ [target.'cfg(target_os = "linux")'.dependencies]
27
+ target-dep = { version = "0.1.0", optional = true }
28
+
21
29
[lints.cargo]
22
30
implicit-features = "warn"
23
31
"# ,
You can’t perform that action at this time.
0 commit comments