This is an automated email from the ASF dual-hosted git repository.

zhjwpku pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-cpp.git


The following commit(s) were added to refs/heads/main by this push:
     new 71c1faae refactor: remove [[nodiscard]] from functions not returning 
Status/Result (#1087)
71c1faae is described below

commit 71c1faae64c15ba216da97770ea70449af48763b
Author: Sreesh Maheshwar <[email protected]>
AuthorDate: Sat Nov 21 07:54:30 2026 +0000

    refactor: remove [[nodiscard]] from functions not returning Status/Result 
(#1087)
    
    Removes `[[nodiscard]]` from functions that don't return `Status`/`Result`: 
the `Equals` overrides, `SchemaField::optional()`, and the `ErrorCollector` 
getters. `Status`/`Result` returns keep it.
    
    Unused results from these functions aren't bugs worth warning about.
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
---
 src/iceberg/partition_field.h      | 2 +-
 src/iceberg/schema_field.h         | 2 +-
 src/iceberg/sort_field.h           | 2 +-
 src/iceberg/transform.h            | 4 ++--
 src/iceberg/transform_function.h   | 4 ++--
 src/iceberg/util/error_collector.h | 6 +++---
 6 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/iceberg/partition_field.h b/src/iceberg/partition_field.h
index 5206cf26..be021048 100644
--- a/src/iceberg/partition_field.h
+++ b/src/iceberg/partition_field.h
@@ -64,7 +64,7 @@ class ICEBERG_EXPORT PartitionField : public 
util::Formattable {
 
  private:
   /// \brief Compare two fields for equality.
-  [[nodiscard]] bool Equals(const PartitionField& other) const;
+  bool Equals(const PartitionField& other) const;
 
   int32_t source_id_;
   int32_t field_id_;
diff --git a/src/iceberg/schema_field.h b/src/iceberg/schema_field.h
index 86bfb92b..edf61316 100644
--- a/src/iceberg/schema_field.h
+++ b/src/iceberg/schema_field.h
@@ -89,7 +89,7 @@ class ICEBERG_EXPORT SchemaField : public 
iceberg::util::Formattable {
   const std::shared_ptr<Type>& type() const;
 
   /// \brief Get whether the field is optional.
-  [[nodiscard]] bool optional() const;
+  bool optional() const;
 
   /// \brief Get the field documentation.
   std::string_view doc() const;
diff --git a/src/iceberg/sort_field.h b/src/iceberg/sort_field.h
index 223c573b..167b652a 100644
--- a/src/iceberg/sort_field.h
+++ b/src/iceberg/sort_field.h
@@ -121,7 +121,7 @@ class ICEBERG_EXPORT SortField : public util::Formattable {
 
  private:
   /// \brief Compare two fields for equality.
-  [[nodiscard]] bool Equals(const SortField& other) const;
+  bool Equals(const SortField& other) const;
 
   int32_t source_id_;
   std::shared_ptr<Transform> transform_;
diff --git a/src/iceberg/transform.h b/src/iceberg/transform.h
index 12464086..979620cb 100644
--- a/src/iceberg/transform.h
+++ b/src/iceberg/transform.h
@@ -237,7 +237,7 @@ class ICEBERG_EXPORT Transform : public util::Formattable {
   Transform(TransformType transform_type, int32_t param);
 
   /// \brief Checks equality with another Transform instance.
-  [[nodiscard]] virtual bool Equals(const Transform& other) const;
+  virtual bool Equals(const Transform& other) const;
 
   TransformType transform_type_;
   /// Optional parameter (e.g., num_buckets, width)
@@ -283,7 +283,7 @@ class ICEBERG_EXPORT TransformFunction {
 
  protected:
   /// \brief Compare the common properties of two transform functions for 
equality.
-  [[nodiscard]] virtual bool Equals(const TransformFunction& other) const;
+  virtual bool Equals(const TransformFunction& other) const;
 
  private:
   TransformType transform_type_;
diff --git a/src/iceberg/transform_function.h b/src/iceberg/transform_function.h
index 14e623e0..24799aeb 100644
--- a/src/iceberg/transform_function.h
+++ b/src/iceberg/transform_function.h
@@ -70,7 +70,7 @@ class ICEBERG_EXPORT BucketTransform : public 
TransformFunction {
       std::shared_ptr<Type> const& source_type, int32_t num_buckets);
 
  private:
-  [[nodiscard]] bool Equals(const TransformFunction& other) const override;
+  bool Equals(const TransformFunction& other) const override;
 
   int32_t num_buckets_;
 };
@@ -99,7 +99,7 @@ class ICEBERG_EXPORT TruncateTransform : public 
TransformFunction {
       std::shared_ptr<Type> const& source_type, int32_t width);
 
  private:
-  [[nodiscard]] bool Equals(const TransformFunction& other) const override;
+  bool Equals(const TransformFunction& other) const override;
 
   int32_t width_;
 };
diff --git a/src/iceberg/util/error_collector.h 
b/src/iceberg/util/error_collector.h
index d8834f28..9919404b 100644
--- a/src/iceberg/util/error_collector.h
+++ b/src/iceberg/util/error_collector.h
@@ -181,12 +181,12 @@ class ICEBERG_EXPORT ErrorCollector {
   /// \brief Check if any errors have been collected
   ///
   /// \return true if there are accumulated errors
-  [[nodiscard]] bool has_errors() const { return !errors_.empty(); }
+  bool has_errors() const { return !errors_.empty(); }
 
   /// \brief Get the number of errors collected
   ///
   /// \return The count of accumulated errors
-  [[nodiscard]] size_t error_count() const { return errors_.size(); }
+  size_t error_count() const { return errors_.size(); }
 
   /// \brief Check for accumulated errors and return them if any exist
   ///
@@ -220,7 +220,7 @@ class ICEBERG_EXPORT ErrorCollector {
   void ClearErrors() { errors_.clear(); }
 
   /// \brief Get read-only access to all collected errors
-  [[nodiscard]] const std::vector<Error>& errors() const { return errors_; }
+  const std::vector<Error>& errors() const { return errors_; }
 
  private:
   void RecordError(Error err) { errors_.push_back(std::move(err)); }

Reply via email to