File tree 6 files changed +54
-8
lines changed
6 files changed +54
-8
lines changed Original file line number Diff line number Diff line change 7
7
matrix :
8
8
include :
9
9
- rust : nightly
10
- env : FEATURES="--features testing_only_proc_macro2_nightly"
11
- allow_failures :
12
- - rust : nightly
10
+ env : FEATURES="--features nightly"
13
11
14
12
script :
15
13
- cargo test $FEATURES
Original file line number Diff line number Diff line change 1
- # v0.2.5 (2018-XX-XX)
1
+ # v0.2.6 (2018-XX-XX)
2
+
3
+ * Fix compilation with ` #[deny(warnings)] ` with the ` ! ` type (https://github.com/rust-lang/rust/pull/49039#issuecomment-376420816 ) by [ @TeXitoi ] ( https://github.com/TeXitoi )
2
4
3
5
* Improve first example in the documentation ([ #82 ] ( https://github.com/TeXitoi/structopt/issues/82 ) ) by [ @TeXitoi ] ( https://github.com/TeXitoi )
4
6
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ readme = "README.md"
12
12
13
13
[features ]
14
14
default = [" clap/default" ]
15
- testing_only_proc_macro2_nightly = [" structopt-derive/testing_only_proc_macro2_nightly " ]
15
+ nightly = [" structopt-derive/nightly " ]
16
16
17
17
[badges ]
18
18
travis-ci = { repository = " TeXitoi/structopt" }
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ quote = "0.4"
18
18
proc-macro2 = " 0.2"
19
19
20
20
[features ]
21
- testing_only_proc_macro2_nightly = [" proc-macro2/nightly" ]
21
+ nightly = [" proc-macro2/nightly" ]
22
22
23
23
[lib ]
24
24
proc-macro = true
Original file line number Diff line number Diff line change @@ -381,7 +381,7 @@ fn impl_structopt_for_struct(
381
381
#from_clap
382
382
}
383
383
384
- #[ allow( dead_code) ]
384
+ #[ allow( dead_code, unreachable_code ) ]
385
385
#[ doc( hidden) ]
386
386
impl #name {
387
387
#augment_clap
@@ -406,7 +406,7 @@ fn impl_structopt_for_enum(
406
406
#from_clap
407
407
}
408
408
409
- #[ allow( unused_variables, dead_code) ]
409
+ #[ allow( unused_variables, dead_code, unreachable_code ) ]
410
410
#[ doc( hidden) ]
411
411
impl #name {
412
412
#augment_clap
Original file line number Diff line number Diff line change
1
+ // Copyright 2018 Guillaume Pinot (@TeXitoi) <[email protected] >
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6
+ // option. This file may not be copied, modified, or distributed
7
+ // except according to those terms.
8
+
9
+ #![ deny( warnings) ]
10
+ #![ cfg( feature = "nightly" ) ] // TODO: remove that when never is stable
11
+
12
+ #[ macro_use]
13
+ extern crate structopt;
14
+
15
+ use structopt:: StructOpt ;
16
+
17
+ fn try_str ( s : & str ) -> Result < String , !> {
18
+ Ok ( s. into ( ) )
19
+ }
20
+
21
+ #[ test]
22
+ fn warning_never_struct ( ) {
23
+ #[ derive( Debug , PartialEq , StructOpt ) ]
24
+ struct Opt {
25
+ #[ structopt( parse( try_from_str = "try_str" ) ) ]
26
+ s : String ,
27
+ }
28
+ assert_eq ! ( Opt { s: "foo" . to_string( ) } ,
29
+ Opt :: from_iter( & [ "test" , "foo" ] ) ) ;
30
+
31
+ }
32
+
33
+ #[ test]
34
+ fn warning_never_enum ( ) {
35
+ #[ derive( Debug , PartialEq , StructOpt ) ]
36
+ enum Opt {
37
+ Foo {
38
+ #[ structopt( parse( try_from_str = "try_str" ) ) ]
39
+ s : String ,
40
+ }
41
+ }
42
+ assert_eq ! ( Opt :: Foo { s: "foo" . to_string( ) } ,
43
+ Opt :: from_iter( & [ "test" , "Foo" , "foo" ] ) ) ;
44
+
45
+ }
46
+
You can’t perform that action at this time.
0 commit comments