Enable readability-redundant-declaration (#143982)

Fixes #ISSUE_NUMBER

Pull Request resolved: https://github.com/pytorch/pytorch/pull/143982
Approved by: https://github.com/Skylion007
This commit is contained in:
cyy
2024-12-31 00:20:10 +00:00
committed by PyTorch MergeBot
parent 934eaa503f
commit af629a8146
5 changed files with 2 additions and 8 deletions

View File

@ -60,7 +60,6 @@ readability-simplify-subscript-expr,
readability-string-compare,
-readability-redundant-access-specifiers,
-readability-redundant-control-flow,
-readability-redundant-declaration,
'
HeaderFilterRegex: '^(aten/|c10/|torch/).*$'
WarningsAsErrors: '*'

View File

@ -23,11 +23,6 @@
namespace c10 {
DispatchKey computeDispatchKey(
std::optional<ScalarType> dtype,
std::optional<Layout> layout,
std::optional<Device> device);
inline ScalarType dtype_or_default(std::optional<ScalarType> dtype) {
return dtype.value_or(get_default_dtype_as_scalartype());
}

View File

@ -149,8 +149,6 @@ static PyObject* THPSize_repr(THPSize* self) {
END_HANDLE_TH_ERRORS
}
extern PyTypeObject THPSizeType;
template <typename FnType, FnType fn, typename... Args>
static PyObject* wrap_tuple_fn(Args... args) {
THPObjectPtr result((*fn)(std::forward<Args>(args)...));

View File

@ -34,6 +34,7 @@ static inline int PyCode_GetNFreevars(PyCodeObject* code) {
// Provided by CPython but getting the header for them is very hard
#if IS_PYTHON_3_11_PLUS
// NOLINTNEXTLINE(readability-redundant-declaration)
PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference* self);
#else
extern void _PyWeakref_ClearRef(PyWeakReference* self);

View File

@ -227,6 +227,7 @@ TORCH_API at::ClassTypePtr getCustomClass(const std::string& name);
// Given an IValue, return true if the object contained in that IValue
// is a custom C++ class, otherwise return false.
// NOLINTNEXTLINE(readability-redundant-declaration)
TORCH_API bool isCustomClass(const c10::IValue& v);
// This API is for testing purposes ONLY. It should not be used in