qmlformat: Pass QQmlFormatOptions by const ref
There actually is a code path that returns it as-is and that saves a copy this way. Coverity-Id: 469518 Coverity-Id: 469514 Change-Id: I50bcfe6c30648baba192233003d4a77fb8a4d048 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
This commit is contained in:
parent
5f30988f01
commit
5ecfe3d57f
|
@ -249,18 +249,24 @@ int main(int argc, char *argv[])
|
|||
if (options.writeDefaultSettingsEnabled())
|
||||
return settings.writeDefaults() ? 0 : -1;
|
||||
|
||||
auto getSettings = [&](const QString &file, QQmlFormatOptions options) {
|
||||
auto getSettings = [&](const QString &file, const QQmlFormatOptions &options) {
|
||||
// Perform formatting inplace if --files option is set.
|
||||
if (!options.files().isEmpty())
|
||||
options.setIsInplace(true);
|
||||
const bool hasFiles = !options.files().isEmpty();
|
||||
|
||||
if (options.ignoreSettingsEnabled() || !settings.search(file))
|
||||
return options;
|
||||
if (options.ignoreSettingsEnabled() || !settings.search(file)) {
|
||||
if (!hasFiles)
|
||||
return options;
|
||||
|
||||
QQmlFormatOptions perFileOptions = options;
|
||||
perFileOptions.setIsInplace(true);
|
||||
return perFileOptions;
|
||||
}
|
||||
|
||||
QQmlFormatOptions perFileOptions = options;
|
||||
if (hasFiles)
|
||||
perFileOptions.setIsInplace(true);
|
||||
|
||||
perFileOptions.applySettings(settings);
|
||||
|
||||
return perFileOptions;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue