lib&contrib: remove some useless truisms.
authorJean Privat <jean@pryen.org>
Wed, 28 Jun 2017 19:14:31 +0000 (15:14 -0400)
committerJean Privat <jean@pryen.org>
Mon, 17 Jul 2017 13:58:39 +0000 (09:58 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

contrib/benitlux/src/server/benitlux_daily.nit
lib/curl/native_curl.nit
lib/gamnit/network/client.nit
lib/nitcorn/examples/src/htcpcp_server.nit
src/metrics/codesmells_metrics.nit
tests/test_postgres_native.nit
tests/test_postgres_nity.nit

index 7878de2..4268c8e 100644 (file)
@@ -246,7 +246,7 @@ end
 if "NIT_TESTING".environ == "true" then exit 0
 
 opts.parse args
-if not opts.errors.is_empty or opts.help.value == true then
+if not opts.errors.is_empty or opts.help.value then
        print opts.errors.join("\n")
        print "Usage: benitlux_daily [Options]"
        opts.usage
index d611dbf..1f5cd11 100644 (file)
@@ -87,8 +87,8 @@ extern class NativeCurl `{ CURL * `}
        fun easy_setopt(opt: CURLOption, obj: Object): CURLCode
        do
                if obj isa Int then return native_setopt_int(opt, obj)
-               if obj isa Bool and obj == true then return native_setopt_int(opt, 1)
-               if obj isa Bool and obj == false then return native_setopt_int(opt, 0)
+               if obj == true then return native_setopt_int(opt, 1)
+               if obj == false then return native_setopt_int(opt, 0)
                if obj isa String then return native_setopt_string(opt, obj)
                if obj isa FileWriter then return native_setopt_file(opt, obj._file.as(not null))
                if obj isa CURLSList then return native_setopt_slist(opt, obj)
@@ -324,7 +324,7 @@ extern class CURLSList `{ struct curl_slist * `}
                var r = new Array[String]
                var cursor = self
                loop
-                       if native_data_reachable(cursor) != true then break
+                       if not native_data_reachable(cursor) then break
                        r.add(native_data(cursor))
                        cursor = native_next(cursor)
                end
index 8aad96f..95afff8 100644 (file)
@@ -62,7 +62,7 @@ class RemoteServer
        var socket: nullable TCPStream = null
 
        # Is this connection connected?
-       fun connected: Bool do return socket != null and socket.connected == true
+       fun connected: Bool do return socket != null and socket.connected
 
        # `BinarySerializer` used to send data to this client through `socket`
        var writer: BinarySerializer is noinit
index 315d76f..73177a1 100644 (file)
@@ -36,7 +36,7 @@ class HTCPCPAction
                var method = http_request.method
                var response: HttpResponse
 
-               if is_teapot == true then
+               if is_teapot then
                        response = new HttpResponse(418)
                        response.body = "I'm a teapot!\n"
                        response.header["Content-Type"] = "text"
index 1bd502d..d09e769 100644 (file)
@@ -117,7 +117,7 @@ class BadConceptionFinder
                bad_conception_elements.add(new FeatureEnvy(phase))
                bad_conception_elements.add(new LongMethod(phase))
                for bad_conception_element in bad_conception_elements do
-                       if bad_conception_element.collect(self.mclassdef,phase.toolcontext.modelbuilder) == true then array_badconception.add(bad_conception_element)
+                       if bad_conception_element.collect(self.mclassdef,phase.toolcontext.modelbuilder) then array_badconception.add(bad_conception_element)
                end
        end
 
index a228993..b7c5a49 100644 (file)
@@ -37,7 +37,7 @@ assert postgres_select: result.status.is_ok else print_error db.error
 assert postgres_ntuples: result.ntuples == 2 else print_error db.error
 assert postgres_nfields: result.nfields == 3 else print_error db.error
 assert postgres_fname: result.fname(0) == "aname" else print_error db.error
-assert postgres_isnull: result.is_null(0,0) == false else print_error db.error
+assert postgres_isnull: not result.is_null(0,0) else print_error db.error
 assert postgres_value: result.value(0,0) == "Whale" else print_error db.error
 
 var cols: Int = result.nfields
index 900aac9..4421a02 100644 (file)
@@ -40,7 +40,7 @@ assert raw_exec: result.is_ok else print db.error
 
 assert postgres_nfields: result.nfields == 4 else print_error db.error
 assert postgres_fname: result.fname(0) == "uname" else print_error db.error
-assert postgres_isnull: result.is_null(0,0) == false else print_error db.error
+assert postgres_isnull: not result.is_null(0,0) else print_error db.error
 assert postgres_value: result.value(0,0) == "Bob" else print_error db.error
 
 assert drop_table: db.execute("DROP TABLE users_{db_suffix}") else print db.error