[libcxx-commits] [libcxx] [libc++] Remove unnecessary static_casts in std::forward_list (PR #130310)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 7 09:32:56 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff d1bd1c7e825d190fc47cd06956c381cc0f70fba8 976cc9ef14d98076514f30831fba5b7515491706 --extensions  -- libcxx/include/forward_list
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list
index ef18d64644..1d1415aaa0 100644
--- a/libcxx/include/forward_list
+++ b/libcxx/include/forward_list
@@ -363,12 +363,8 @@ class _LIBCPP_TEMPLATE_VIS __forward_list_iterator {
 
   __begin_node_pointer __ptr_;
 
-  _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __get_begin() const {
-    return __ptr_;
-  }
-  _LIBCPP_HIDE_FROM_ABI __node_pointer __get_unsafe_node_pointer() const {
-    return static_cast<__node_pointer>(__ptr_);
-  }
+  _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __get_begin() const { return __ptr_; }
+  _LIBCPP_HIDE_FROM_ABI __node_pointer __get_unsafe_node_pointer() const { return static_cast<__node_pointer>(__ptr_); }
 
   _LIBCPP_HIDE_FROM_ABI explicit __forward_list_iterator(nullptr_t) _NOEXCEPT : __ptr_(nullptr) {}
 
@@ -427,12 +423,8 @@ class _LIBCPP_TEMPLATE_VIS __forward_list_const_iterator {
 
   __begin_node_pointer __ptr_;
 
-  _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __get_begin() const {
-    return __ptr_;
-  }
-  _LIBCPP_HIDE_FROM_ABI __node_pointer __get_unsafe_node_pointer() const {
-    return static_cast<__node_pointer>(__ptr_);
-  }
+  _LIBCPP_HIDE_FROM_ABI __begin_node_pointer __get_begin() const { return __ptr_; }
+  _LIBCPP_HIDE_FROM_ABI __node_pointer __get_unsafe_node_pointer() const { return static_cast<__node_pointer>(__ptr_); }
 
   _LIBCPP_HIDE_FROM_ABI explicit __forward_list_const_iterator(nullptr_t) _NOEXCEPT : __ptr_(nullptr) {}
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/130310


More information about the libcxx-commits mailing list