]> git.lyx.org Git - lyx.git/commitdiff
use std::move() instead of copying when value is no longer used
authorJuergen Spitzmueller <spitz@lyx.org>
Sat, 7 Sep 2024 10:50:27 +0000 (12:50 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Sat, 7 Sep 2024 10:50:27 +0000 (12:50 +0200)
This is mainly to shut down coverity which nowadays nags on this.
I am not sure whether we really gain something in these cases.

src/BufferView.cpp
src/Encoding.cpp
src/insets/InsetNomencl.cpp

index b1ac2da82c3c0d69a66543f97dedc5722009f911..eeba7b86c3ded88ea8577339dc849d7324268e06 100644 (file)
@@ -1707,7 +1707,7 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                        string label = dit.innerParagraph().getLabelForXRef();
                        if (!label.empty()) {
                                // if the paragraph has a label, we refer to this
-                               string const arg = (type.empty()) ? label : label + " " + type;
+                               string const arg = (type.empty()) ? move(label) : move(label) + " " + type;
                                lyx::dispatch(FuncRequest(LFUN_REFERENCE_INSERT, arg));
                                break;
                        } else {
index cff17ee051807d3051c2666a4eb8012a0d4d53ba..267298927f8f96445be740d1083a901b2d0713c2 100644 (file)
@@ -798,7 +798,7 @@ docstring Encodings::convertLaTeXCommands(docstring const & str, bool const lite
                if (!cnvtd.empty()) {
                        // it did, so we'll take that bit and proceed with what's left
                        ret += cnvtd;
-                       val = rem;
+                       val = move(rem);
                        continue;
                }
                // it's a command of some sort
index 484d731abee23cd4310f133521a4dcb0a7fd81c9..012ef4fc880f54ace1cd091d1d2dc842b794a3a9 100644 (file)
@@ -440,7 +440,7 @@ docstring nomenclWidest(Buffer const & buffer)
                                msymb.size();
                        if (wx > w) {
                                w = wx;
-                               symb = symbol;
+                               symb = move(symbol);
                        }
                }
        }