diff --git a/3d-viewer/3d_viewer/eda_3d_viewer_settings.cpp b/3d-viewer/3d_viewer/eda_3d_viewer_settings.cpp index bbb84a7780..d292a4a52c 100644 --- a/3d-viewer/3d_viewer/eda_3d_viewer_settings.cpp +++ b/3d-viewer/3d_viewer/eda_3d_viewer_settings.cpp @@ -320,7 +320,7 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() : m_params.emplace_back( new PARAM_LIST( "render.raytrace_lightColor", &m_Render.raytrace_lightColor, - default_colors ) ); + std::move( default_colors ) ) ); const std::vector default_elevation = { diff --git a/common/git/kicad_git_common.cpp b/common/git/kicad_git_common.cpp index 6134fd4102..94631b4b0c 100644 --- a/common/git/kicad_git_common.cpp +++ b/common/git/kicad_git_common.cpp @@ -292,7 +292,7 @@ std::pair,std::set> KIGIT_COMMON::GetDifferentFiles { std::set* modified_set_internal = static_cast*>( payload ); wxString filePath = wxString::Format( "%s%s", root, git_tree_entry_name( entry ) ); - modified_set_internal->insert( filePath ); + modified_set_internal->insert( std::move( filePath ) ); return 0; // continue walking }, &modified_set ); diff --git a/common/preview_items/polygon_geom_manager.cpp b/common/preview_items/polygon_geom_manager.cpp index 9ddc94de74..b2d0dd100f 100644 --- a/common/preview_items/polygon_geom_manager.cpp +++ b/common/preview_items/polygon_geom_manager.cpp @@ -159,7 +159,7 @@ void POLYGON_GEOM_MANAGER::Reset() } -static SHAPE_LINE_CHAIN build45DegLeader( const VECTOR2I& aEndPoint, SHAPE_LINE_CHAIN aLastPoints ) +static SHAPE_LINE_CHAIN build45DegLeader( const VECTOR2I& aEndPoint, const SHAPE_LINE_CHAIN& aLastPoints ) { if( aLastPoints.PointCount() < 1 ) return SHAPE_LINE_CHAIN(); diff --git a/common/settings/settings_manager.cpp b/common/settings/settings_manager.cpp index 04d840a369..f7c0119ae8 100644 --- a/common/settings/settings_manager.cpp +++ b/common/settings/settings_manager.cpp @@ -1301,7 +1301,7 @@ public: VECTOR_INSERT_TRAVERSER( std::vector& aVec, std::function aCond ) : m_files( aVec ), - m_condition( aCond ) + m_condition( std::move( aCond ) ) { } diff --git a/common/string_utils.cpp b/common/string_utils.cpp index 6232ecdbfb..5348d055af 100644 --- a/common/string_utils.cpp +++ b/common/string_utils.cpp @@ -1311,7 +1311,7 @@ bool ReplaceIllegalFileNameChars( std::string* aName, int aReplaceChar ) } if( changed ) - *aName = result; + *aName = std::move( result ); return changed; } diff --git a/cvpcb/cvpcb_association.h b/cvpcb/cvpcb_association.h index 91fe4d70fc..f7bb4b587a 100644 --- a/cvpcb/cvpcb_association.h +++ b/cvpcb/cvpcb_association.h @@ -29,9 +29,7 @@ */ class CVPCB_ASSOCIATION { - public: - /** * Create an association event that contains all the information needed to modify the footprint * association of a component in cvpcb. @@ -40,15 +38,15 @@ public: * @param aNewFootprint is the new footprint to give to the component * @param aOldFootprint is the old footprint from the component */ - CVPCB_ASSOCIATION( - unsigned int aComponentIndex, LIB_ID aNewFootprint, LIB_ID aOldFootprint = LIB_ID() ) : + CVPCB_ASSOCIATION( unsigned int aComponentIndex, const LIB_ID& aNewFootprint, + const LIB_ID& aOldFootprint = LIB_ID() ) : m_componentIndex( aComponentIndex ), m_newFootprint( aNewFootprint ), m_oldFootprint( aOldFootprint ) {} - CVPCB_ASSOCIATION( - unsigned int aComponentIndex, wxString aNewFootprint, wxString aOldFootprint = "" ) : + CVPCB_ASSOCIATION( unsigned int aComponentIndex, const wxString& aNewFootprint, + const wxString& aOldFootprint = "" ) : m_componentIndex( aComponentIndex ) { m_newFootprint.Parse( aNewFootprint ); @@ -115,12 +113,10 @@ public: m_oldFootprint = aOldFootprint; } - private: unsigned int m_componentIndex; LIB_ID m_newFootprint; LIB_ID m_oldFootprint; - }; diff --git a/include/libeval_compiler/libeval_compiler.h b/include/libeval_compiler/libeval_compiler.h index c021edf8fe..cbe1723521 100644 --- a/include/libeval_compiler/libeval_compiler.h +++ b/include/libeval_compiler/libeval_compiler.h @@ -255,14 +255,14 @@ public: void SetDeferredEval( std::function aLambda ) { m_type = VT_NUMERIC; - m_lambdaDbl = aLambda; + m_lambdaDbl = std::move( aLambda ); m_isDeferredDbl = true; } void SetDeferredEval( std::function aLambda ) { m_type = VT_STRING; - m_lambdaStr = aLambda; + m_lambdaStr = std::move( aLambda ); m_isDeferredStr = true; } diff --git a/include/settings/parameters.h b/include/settings/parameters.h index 0a9ec00675..2129e5b9f1 100644 --- a/include/settings/parameters.h +++ b/include/settings/parameters.h @@ -92,24 +92,24 @@ template class PARAM : public PARAM_BASE { public: - PARAM( const std::string& aJsonPath, ValueType* aPtr, ValueType aDefault, + PARAM( const std::string& aJsonPath, ValueType* aPtr, const ValueType& aDefault, bool aReadOnly = false ) : PARAM_BASE( aJsonPath, aReadOnly ), m_min(), m_max(), m_use_minmax( false ), m_ptr( aPtr ), - m_default( std::move( aDefault ) ) + m_default( aDefault ) { } - PARAM( const std::string& aJsonPath, ValueType* aPtr, ValueType aDefault, ValueType aMin, - ValueType aMax, bool aReadOnly = false ) : + PARAM( const std::string& aJsonPath, ValueType* aPtr, const ValueType& aDefault, + const ValueType& aMin, const ValueType& aMax, bool aReadOnly = false ) : PARAM_BASE( aJsonPath, aReadOnly ), - m_min( std::move( aMin ) ), - m_max( std::move( aMax ) ), + m_min( aMin ), + m_max( aMax ), m_use_minmax( true ), m_ptr( aPtr ), - m_default( std::move( aDefault ) ) + m_default( aDefault ) { } void Load( const JSON_SETTINGS& aSettings, bool aResetIfMissing = true ) const override diff --git a/pcbnew/drc/drc_test_provider.cpp b/pcbnew/drc/drc_test_provider.cpp index ee7b745dc8..4686aefd71 100644 --- a/pcbnew/drc/drc_test_provider.cpp +++ b/pcbnew/drc/drc_test_provider.cpp @@ -373,8 +373,8 @@ bool DRC_TEST_PROVIDER::isInvisibleText( const BOARD_ITEM* aItem ) const } -wxString DRC_TEST_PROVIDER::formatMsg( const wxString& aFormatString, const wxString& aSource, double aConstraint, - double aActual, EDA_DATA_TYPE aType ) +wxString DRC_TEST_PROVIDER::formatMsg( const wxString& aFormatString, const wxString& aSource, + double aConstraint, double aActual, EDA_DATA_TYPE aType ) { wxString constraint_str = MessageTextFromValue( aConstraint, true, aType ); wxString actual_str = MessageTextFromValue( aActual, true, aType ); @@ -386,7 +386,7 @@ wxString DRC_TEST_PROVIDER::formatMsg( const wxString& aFormatString, const wxSt actual_str = StringFromValue( aActual, true, aType ); } - return wxString::Format( aFormatString, aSource, constraint_str, actual_str ); + return wxString::Format( aFormatString, aSource, std::move( constraint_str ), std::move( actual_str ) ); } wxString DRC_TEST_PROVIDER::formatMsg( const wxString& aFormatString, const wxString& aSource, @@ -402,5 +402,5 @@ wxString DRC_TEST_PROVIDER::formatMsg( const wxString& aFormatString, const wxSt actual_str = StringFromValue( aActual, true ); } - return wxString::Format( aFormatString, aSource, constraint_str, actual_str ); + return wxString::Format( aFormatString, aSource, std::move( constraint_str ), std::move( actual_str ) ); } diff --git a/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp b/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp index 57a2639a78..e2e37e7162 100644 --- a/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp +++ b/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp @@ -515,13 +515,13 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run() case DIFF_PAIR_GAP_CONSTRAINT: key.gapConstraint = constraint.GetValue(); key.gapRule = parentRule; - key.gapRuleName = ruleName; + key.gapRuleName = std::move( ruleName ); break; case MAX_UNCOUPLED_CONSTRAINT: key.uncoupledConstraint = constraint.GetValue(); key.uncoupledRule = parentRule; - key.uncoupledRuleName = ruleName; + key.uncoupledRuleName = std::move( ruleName ); break; default: diff --git a/pcbnew/netlist_reader/kicad_netlist_reader.cpp b/pcbnew/netlist_reader/kicad_netlist_reader.cpp index a4f1cfe3cc..59c045c8b3 100644 --- a/pcbnew/netlist_reader/kicad_netlist_reader.cpp +++ b/pcbnew/netlist_reader/kicad_netlist_reader.cpp @@ -415,7 +415,7 @@ void KICAD_NETLIST_PARSER::parseComponent() } if( !propName.IsEmpty() ) - properties[ propName ] = propValue; + properties[propName] = std::move( propValue ); } break; @@ -448,7 +448,7 @@ void KICAD_NETLIST_PARSER::parseComponent() } if( !fieldName.IsEmpty() ) - fields[fieldName] = fieldValue; + fields[fieldName] = std::move( fieldValue ); } else {