Add bugprone-use-after-move

It's generally bad practice to use something after it's been std::moved
from.
This commit is contained in:
JJ Marr 2024-09-22 15:23:06 -04:00 committed by Charles Dang
parent 121196eb70
commit af82672ca9
4 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
---
Checks: '-*,modernize-use-nullptr,performance-unnecessary-value-param'
Checks: '-*,bugprone-use-after-move,modernize-use-nullptr,performance-unnecessary-value-param'
WarningsAsErrors: true
...

View File

@ -370,7 +370,6 @@ void story_viewer::draw_floating_image(floating_image_list::const_iterator image
image["name"] = floating_image.file();
config cfg{"image", std::move(image)};
cfg.add_child("image", std::move(image));
window_canvas.append_cfg(std::move(cfg));
// Needed to make the background redraw correctly.

View File

@ -130,12 +130,13 @@ unsigned pane::create_item(const widget_data& item_data,
}
}
const auto item_id = item.id;
items_.push_back(std::move(item));
event::message message;
fire(event::REQUEST_PLACEMENT, *this, message);
return item.id;
return item_id;
}
void pane::place(const point& origin, const point& size)

View File

@ -918,7 +918,7 @@ void generate_races_sections(const config* help_cfg, section& sec, int level)
bool process_queue_again = true;
while(process_queue_again && !taxonomy_queue.empty()) {
process_queue_again = false;
std::vector<taxonomy_queue_type> to_process = std::move(taxonomy_queue);
auto to_process = std::exchange(taxonomy_queue, {});
for(auto& x : to_process) {
auto parent = find_section(sec, x.parent_id);