From d4c285226c67bc4958c66d51aea522e2971183b7 Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Mon, 20 Mar 2023 23:47:23 +0800 Subject: [PATCH] fix: sonarcloud analysis if,switch, and range-based for loop initializer should be used to reduce scope of variables cpp:S6004 --- mainwindow.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mainwindow.cc b/mainwindow.cc index 1ad65111..d78a9c76 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -4200,8 +4200,7 @@ void MainWindow::focusWordList() void MainWindow::addWordToHistory( const QString & word ) { - QRegularExpressionMatch m = RX::Epwing::refWord.match( word ); - if( m.hasMatch() ) + if(QRegularExpressionMatch m = RX::Epwing::refWord.match( word ); m.hasMatch() ) return; history.addItem( History::Item( 1, word.trimmed() ) ); }