Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion speller/main/build-dictionary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

using namespace std;

const list<string> common_words{

Check warning on line 10 in speller/main/build-dictionary.cc

View check run for this annotation

Aspect Workflows / Lint

ClangTidy found an issue

initialization of 'common_words' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
"a", "about", "after", "all", "also", "an", "and",
"any", "as", "at", "back", "be", "because", "but",
"by", "can", "come", "could", "day", "do", "even",
Expand All @@ -29,7 +29,7 @@
Speller::LookupEngine engine("spell.db", true);

for_each(common_words.begin(), common_words.end(),
[&](const string &word) { engine.AddEntry(word); });
[&](string word) { engine.AddEntry(word); });

Check warning on line 32 in speller/main/build-dictionary.cc

View check run for this annotation

Aspect Workflows / Lint

ClangTidy found an issue

the parameter 'word' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ClangTidy provided a suggestion

Suggested change
[&](string word) { engine.AddEntry(word); });
[&](const string& word) { engine.AddEntry(word); });


return 0;
}