File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -34,15 +34,16 @@ impl Function for And {
34
34
35
35
fn invoke ( & self , args : & [ Value ] , _context : & Context ) -> Result < Value , DscError > {
36
36
debug ! ( "{}" , t!( "functions.and.invoked" ) ) ;
37
- let mut result = true ;
38
37
for arg in args {
39
38
if let Some ( value) = arg. as_bool ( ) {
40
- result &= value;
39
+ if !value {
40
+ return Ok ( Value :: Bool ( false ) ) ;
41
+ }
41
42
} else {
42
43
return Err ( DscError :: Parser ( t ! ( "functions.invalidArguments" ) . to_string ( ) ) ) ;
43
44
}
44
45
}
45
- Ok ( Value :: Bool ( result ) )
46
+ Ok ( Value :: Bool ( true ) )
46
47
}
47
48
}
48
49
Original file line number Diff line number Diff line change @@ -34,15 +34,16 @@ impl Function for Or {
34
34
35
35
fn invoke ( & self , args : & [ Value ] , _context : & Context ) -> Result < Value , DscError > {
36
36
debug ! ( "{}" , t!( "functions.or.invoked" ) ) ;
37
- let mut result = false ;
38
37
for arg in args {
39
38
if let Some ( value) = arg. as_bool ( ) {
40
- result |= value;
39
+ if value {
40
+ return Ok ( Value :: Bool ( true ) ) ;
41
+ }
41
42
} else {
42
43
return Err ( DscError :: Parser ( t ! ( "functions.invalidArguments" ) . to_string ( ) ) ) ;
43
44
}
44
45
}
45
- Ok ( Value :: Bool ( result ) )
46
+ Ok ( Value :: Bool ( false ) )
46
47
}
47
48
}
48
49
You can’t perform that action at this time.
0 commit comments