From a75e3514c2293d55afbd99c0488dd90c8b619fc4 Mon Sep 17 00:00:00 2001 From: rillig Date: Sun, 28 Feb 2021 12:45:47 +0000 Subject: [PATCH] tests/lint: shorten code for checking redundancy in files No functional change. --- usr.bin/xlint/lint1/check-msgs.lua | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/usr.bin/xlint/lint1/check-msgs.lua b/usr.bin/xlint/lint1/check-msgs.lua index 887f99d5c0fd..73bb8ae37c62 100644 --- a/usr.bin/xlint/lint1/check-msgs.lua +++ b/usr.bin/xlint/lint1/check-msgs.lua @@ -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)