szaszm commented on code in PR #2040:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2040#discussion_r2432859109


##########
libminifi/include/core/state/UpdatePolicy.h:
##########
@@ -94,7 +89,7 @@ class UpdatePolicy {
 class UpdatePolicyBuilder {
  public:
   static std::unique_ptr<UpdatePolicyBuilder> newBuilder(bool enable_all = 
false) {
-    std::unique_ptr<UpdatePolicyBuilder> policy = 
std::unique_ptr<UpdatePolicyBuilder>( new UpdatePolicyBuilder(enable_all));
+    std::unique_ptr<UpdatePolicyBuilder> policy = 
std::unique_ptr<UpdatePolicyBuilder>( new UpdatePolicyBuilder(enable_all));  // 
NOLINT(clang-analyzer-cplusplus.NewDeleteLeaks)

Review Comment:
   I see the bool ctor is public, and I see no reason not to make the move 
constructor public too. Why not do that and avoid an explicit new?
   
   ```suggestion
       auto policy = 
std::unique_ptr<UpdatePolicyBuilder>(UpdatePolicyBuilder(enable_all));
   ```



##########
libminifi/include/core/state/UpdatePolicy.h:
##########
@@ -107,7 +102,7 @@ class UpdatePolicyBuilder {
   }
 
   std::unique_ptr<UpdatePolicy> build() {
-    std::unique_ptr<UpdatePolicy> new_policy = 
std::unique_ptr<UpdatePolicy>(new UpdatePolicy(*(current_policy_.get())));
+    std::unique_ptr<UpdatePolicy> new_policy = 
std::unique_ptr<UpdatePolicy>(new UpdatePolicy(*(current_policy_.get())));  // 
NOLINT(clang-analyzer-cplusplus.NewDeleteLeaks)

Review Comment:
   ```suggestion
       auto new_policy = 
std::unique_ptr<UpdatePolicy>(UpdatePolicy(*current_policy_));
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to