mirror of
https://github.com/esphome/esphome.git
synced 2024-11-24 07:58:09 +01:00
[code-quality] fix performance-unnecessary-value-param
This commit is contained in:
parent
bc3221a55b
commit
61db16bf2d
4 changed files with 12 additions and 4 deletions
|
@ -1,5 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "esphome/components/number/number.h"
|
#include "esphome/components/number/number.h"
|
||||||
#include "esphome/core/automation.h"
|
#include "esphome/core/automation.h"
|
||||||
#include "esphome/core/component.h"
|
#include "esphome/core/component.h"
|
||||||
|
@ -11,7 +13,7 @@ namespace lvgl {
|
||||||
class LVGLNumber : public number::Number {
|
class LVGLNumber : public number::Number {
|
||||||
public:
|
public:
|
||||||
void set_control_lambda(std::function<void(float)> control_lambda) {
|
void set_control_lambda(std::function<void(float)> control_lambda) {
|
||||||
this->control_lambda_ = control_lambda;
|
this->control_lambda_ = std::move(control_lambda);
|
||||||
if (this->initial_state_.has_value()) {
|
if (this->initial_state_.has_value()) {
|
||||||
this->control_lambda_(this->initial_state_.value());
|
this->control_lambda_(this->initial_state_.value());
|
||||||
this->initial_state_.reset();
|
this->initial_state_.reset();
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "esphome/components/select/select.h"
|
#include "esphome/components/select/select.h"
|
||||||
#include "esphome/core/automation.h"
|
#include "esphome/core/automation.h"
|
||||||
#include "esphome/core/component.h"
|
#include "esphome/core/component.h"
|
||||||
|
@ -28,7 +30,7 @@ static std::vector<std::string> split_string(const std::string &str) {
|
||||||
class LVGLSelect : public select::Select {
|
class LVGLSelect : public select::Select {
|
||||||
public:
|
public:
|
||||||
void set_control_lambda(std::function<void(size_t)> lambda) {
|
void set_control_lambda(std::function<void(size_t)> lambda) {
|
||||||
this->control_lambda_ = lambda;
|
this->control_lambda_ = std::move(lambda);
|
||||||
if (this->initial_state_.has_value()) {
|
if (this->initial_state_.has_value()) {
|
||||||
this->control(this->initial_state_.value());
|
this->control(this->initial_state_.value());
|
||||||
this->initial_state_.reset();
|
this->initial_state_.reset();
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "esphome/components/switch/switch.h"
|
#include "esphome/components/switch/switch.h"
|
||||||
#include "esphome/core/automation.h"
|
#include "esphome/core/automation.h"
|
||||||
#include "esphome/core/component.h"
|
#include "esphome/core/component.h"
|
||||||
|
@ -11,7 +13,7 @@ namespace lvgl {
|
||||||
class LVGLSwitch : public switch_::Switch {
|
class LVGLSwitch : public switch_::Switch {
|
||||||
public:
|
public:
|
||||||
void set_control_lambda(std::function<void(bool)> state_lambda) {
|
void set_control_lambda(std::function<void(bool)> state_lambda) {
|
||||||
this->state_lambda_ = state_lambda;
|
this->state_lambda_ = std::move(state_lambda);
|
||||||
if (this->initial_state_.has_value()) {
|
if (this->initial_state_.has_value()) {
|
||||||
this->state_lambda_(this->initial_state_.value());
|
this->state_lambda_(this->initial_state_.value());
|
||||||
this->initial_state_.reset();
|
this->initial_state_.reset();
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "esphome/components/text/text.h"
|
#include "esphome/components/text/text.h"
|
||||||
#include "esphome/core/automation.h"
|
#include "esphome/core/automation.h"
|
||||||
#include "esphome/core/component.h"
|
#include "esphome/core/component.h"
|
||||||
|
@ -11,7 +13,7 @@ namespace lvgl {
|
||||||
class LVGLText : public text::Text {
|
class LVGLText : public text::Text {
|
||||||
public:
|
public:
|
||||||
void set_control_lambda(std::function<void(const std::string)> control_lambda) {
|
void set_control_lambda(std::function<void(const std::string)> control_lambda) {
|
||||||
this->control_lambda_ = control_lambda;
|
this->control_lambda_ = std::move(control_lambda);
|
||||||
if (this->initial_state_.has_value()) {
|
if (this->initial_state_.has_value()) {
|
||||||
this->control_lambda_(this->initial_state_.value());
|
this->control_lambda_(this->initial_state_.value());
|
||||||
this->initial_state_.reset();
|
this->initial_state_.reset();
|
||||||
|
|
Loading…
Reference in a new issue