Skip to content

use std::move() for local variables that are copied but not reused#7308

Open
Goober5000 wants to merge 3 commits intoscp-fs2open:masterfrom
Goober5000:coverity/copy-to-move
Open

use std::move() for local variables that are copied but not reused#7308
Goober5000 wants to merge 3 commits intoscp-fs2open:masterfrom
Goober5000:coverity/copy-to-move

Conversation

@Goober5000
Copy link
Contributor

@Goober5000 Goober5000 commented Mar 21, 2026

Addresses ~140 Coverity "Variable copied when it could be moved" defects across 74 files. Every std::move() targets a local variable whose value is consumed by push_back, emplace, assignment, lambda capture, or a function call and is never read again afterward.

Also use std::make_shared and std::make_unique, per clang.

Addresses ~140 Coverity "Variable copied when it could be moved"
defects across 74 files.  Every std::move() targets a local variable
whose value is consumed by push_back, emplace, assignment, lambda
capture, or a function call and is never read again afterward.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Goober5000 Goober5000 added the coverity An issue flagged by Coverity label Mar 21, 2026
@Goober5000 Goober5000 force-pushed the coverity/copy-to-move branch from 025756b to 8bfdb2e Compare March 21, 2026 06:03
@Goober5000 Goober5000 force-pushed the coverity/copy-to-move branch from 8bfdb2e to 29704fd Compare March 21, 2026 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coverity An issue flagged by Coverity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant