From 9c024d9d3bfcd6cee7c0a39492f7e1fd4f80192d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 28 Jan 2021 10:38:44 +0000 Subject: Use "in" operator in stead of "lsearch -exact" when possible --- library/opt/optparse.tcl | 2 +- library/tcltest/tcltest.tcl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/opt/optparse.tcl b/library/opt/optparse.tcl index 1639379..454b923 100644 --- a/library/opt/optparse.tcl +++ b/library/opt/optparse.tcl @@ -601,7 +601,7 @@ proc ::tcl::OptCheckType {arg type {typeArgs ""}} { return [expr {$arg ? 1 : 0}] } choice { - if {[lsearch -exact $typeArgs $arg] < 0} { + if {$arg ni $typeArgs} { error "invalid choice" } return $arg diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl index 7dc75d7..dedcd7a 100644 --- a/library/tcltest/tcltest.tcl +++ b/library/tcltest/tcltest.tcl @@ -642,7 +642,7 @@ namespace eval tcltest { proc IsVerbose {level} { variable Option - return [expr {[lsearch -exact $Option(-verbose) $level] >= 0}] + return [expr {$level in $Option(-verbose)}] } # Default verbosity is to show bodies of failed tests -- cgit v0.12