File tree Expand file tree Collapse file tree 2 files changed +9
-16
lines changed Expand file tree Collapse file tree 2 files changed +9
-16
lines changed Original file line number Diff line number Diff line change @@ -117,21 +117,17 @@ fn error_with_path() {
117
117
inner : Inner ,
118
118
}
119
119
const CFG : & str = r#"
120
- inner:
121
- test: ABC
122
- "# ;
120
+ inner.test = "ABC"
121
+ "# ;
123
122
124
123
let e = Config :: builder ( )
125
- . add_source ( File :: from_str ( CFG , FileFormat :: Yaml ) )
124
+ . add_source ( File :: from_str ( CFG , FileFormat :: Toml ) )
126
125
. build ( )
127
126
. unwrap ( )
128
127
. try_into :: < Outer > ( )
129
128
. unwrap_err ( ) ;
130
129
131
- if let ConfigError :: Type {
132
- key : Some ( path) , ..
133
- } = e
134
- {
130
+ if let ConfigError :: Type { key : Some ( path) , .. } = e {
135
131
assert_eq ! ( path, "inner.test" ) ;
136
132
} else {
137
133
panic ! ( "Wrong error {:?}" , e) ;
Original file line number Diff line number Diff line change @@ -113,18 +113,15 @@ fn error_with_path() {
113
113
struct Outer {
114
114
inner : Inner ,
115
115
}
116
+
116
117
const CFG : & str = r#"
117
- inner:
118
- test: ABC
119
- "# ;
118
+ inner.test = "ABC"
119
+ "# ;
120
120
121
121
let mut cfg = Config :: default ( ) ;
122
- cfg. merge ( File :: from_str ( CFG , FileFormat :: Yaml ) ) . unwrap ( ) ;
122
+ cfg. merge ( File :: from_str ( CFG , FileFormat :: Toml ) ) . unwrap ( ) ;
123
123
let e = cfg. try_into :: < Outer > ( ) . unwrap_err ( ) ;
124
- if let ConfigError :: Type {
125
- key : Some ( path) , ..
126
- } = e
127
- {
124
+ if let ConfigError :: Type { key : Some ( path) , .. } = e {
128
125
assert_eq ! ( path, "inner.test" ) ;
129
126
} else {
130
127
panic ! ( "Wrong error {:?}" , e) ;
You can’t perform that action at this time.
0 commit comments