Module Name:    src
Committed By:   rillig
Date:           Sun Feb 28 12:45:47 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: check-msgs.lua

Log Message:
tests/lint: shorten code for checking redundancy in files

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/xlint/lint1/check-msgs.lua

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/check-msgs.lua
diff -u src/usr.bin/xlint/lint1/check-msgs.lua:1.8 src/usr.bin/xlint/lint1/check-msgs.lua:1.9
--- src/usr.bin/xlint/lint1/check-msgs.lua:1.8	Sun Feb 28 12:40:00 2021
+++ src/usr.bin/xlint/lint1/check-msgs.lua	Sun Feb 28 12:45:47 2021
@@ -1,5 +1,5 @@
 #! /usr/bin/lua
--- $NetBSD: check-msgs.lua,v 1.8 2021/02/28 12:40:00 rillig Exp $
+-- $NetBSD: check-msgs.lua,v 1.9 2021/02/28 12:45:47 rillig Exp $
 
 --[[
 
@@ -113,14 +113,9 @@ end
 
 local function file_contains(filename, text)
   local f = assert(io.open(filename, "r"))
-  for line in f:lines() do
-    if line:find(text, 1, true) then
-      f:close()
-      return true
-    end
-  end
+  local found = f:read("a"):find(text, 1, true)
   f:close()
-  return false
+  return found
 end
 
 local function check_test_files(msgs)

Reply via email to