fix: sonarcloud analysis

if,switch, and range-based for loop initializer should be used to reduce scope of variables cpp:S6004
This commit is contained in:
Xiao YiFang 2023-03-20 23:47:23 +08:00
parent 736a9aad23
commit d4c285226c

View file

@ -4200,8 +4200,7 @@ void MainWindow::focusWordList()
void MainWindow::addWordToHistory( const QString & word ) void MainWindow::addWordToHistory( const QString & word )
{ {
QRegularExpressionMatch m = RX::Epwing::refWord.match( word ); if(QRegularExpressionMatch m = RX::Epwing::refWord.match( word ); m.hasMatch() )
if( m.hasMatch() )
return; return;
history.addItem( History::Item( 1, word.trimmed() ) ); history.addItem( History::Item( 1, word.trimmed() ) );
} }