Skip to content

Commit 7ed4c0d

Browse files
thevilledevantonmedv
authored andcommitted
refactor(conf): avoid type assertion in map case branch (expr-lang#749)
Simplifies the code by using the type switch variable binding instead of performing an additional type assertion. Signed-off-by: Ville Vesilehto <[email protected]> Co-authored-by: Anton Medvedev <[email protected]>
1 parent 6ce0980 commit 7ed4c0d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

conf/env.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ func Env(env any) Nature {
4646

4747
face := elem.Interface()
4848

49-
switch face.(type) {
49+
switch face := face.(type) {
5050
case types.Map:
51-
n.Fields[key.String()] = face.(types.Map).Nature()
51+
n.Fields[key.String()] = face.Nature()
5252

5353
default:
5454
if face == nil {

0 commit comments

Comments
 (0)