@@ -219,10 +219,8 @@ impl TryFrom<Vec<Yaml>> for FactConfig {
219219 } ;
220220
221221 match k {
222- "paths" if v. is_array ( ) => {
223- let paths = v
224- . as_vec ( )
225- . unwrap ( )
222+ "paths" if let Some ( paths) = v. as_vec ( ) => {
223+ let paths = paths
226224 . iter ( )
227225 . map ( |p| {
228226 let Some ( p) = p. as_str ( ) else {
@@ -236,15 +234,13 @@ impl TryFrom<Vec<Yaml>> for FactConfig {
236234 "paths" if v. is_null ( ) => {
237235 config. paths = Some ( Vec :: new ( ) ) ;
238236 }
239- "grpc" if v. is_hash ( ) => {
240- let grpc = v. as_hash ( ) . unwrap ( ) ;
237+ "grpc" if let Some ( grpc) = v. as_hash ( ) => {
241238 config. grpc = GrpcConfig :: try_from ( grpc) ?;
242239 }
243240 "grpc" if v. is_null ( ) => {
244241 // Nothing to do
245242 }
246- "endpoint" if v. is_hash ( ) => {
247- let endpoint = v. as_hash ( ) . unwrap ( ) ;
243+ "endpoint" if let Some ( endpoint) = v. as_hash ( ) => {
248244 config. endpoint = EndpointConfig :: try_from ( endpoint) ?;
249245 }
250246 "endpoint" if v. is_null ( ) => {
@@ -262,8 +258,7 @@ impl TryFrom<Vec<Yaml>> for FactConfig {
262258 } ;
263259 config. json = Some ( json) ;
264260 }
265- "bpf" if v. is_hash ( ) => {
266- let bpf = v. as_hash ( ) . unwrap ( ) ;
261+ "bpf" if let Some ( bpf) = v. as_hash ( ) => {
267262 config. bpf = BpfConfig :: try_from ( bpf) ?;
268263 }
269264 "bpf" if v. is_null ( ) => {
0 commit comments