mirror of
				https://github.com/pytorch/pytorch.git
				synced 2025-11-04 08:00:58 +08:00 
			
		
		
		
	[2/N] Enable clang-tidy to c10/test/*cpp (#110270)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/110270 Approved by: https://github.com/Skylion007, https://github.com/kit1980
This commit is contained in:
		@ -94,14 +94,14 @@ struct CopyCounting {
 | 
			
		||||
  CopyCounting() : move_count(0), copy_count(0) {}
 | 
			
		||||
  CopyCounting(const CopyCounting& rhs)
 | 
			
		||||
      : move_count(rhs.move_count), copy_count(rhs.copy_count + 1) {}
 | 
			
		||||
  CopyCounting(CopyCounting&& rhs)
 | 
			
		||||
  CopyCounting(CopyCounting&& rhs) noexcept
 | 
			
		||||
      : move_count(rhs.move_count + 1), copy_count(rhs.copy_count) {}
 | 
			
		||||
  CopyCounting& operator=(const CopyCounting& rhs) {
 | 
			
		||||
    move_count = rhs.move_count;
 | 
			
		||||
    copy_count = rhs.copy_count + 1;
 | 
			
		||||
    return *this;
 | 
			
		||||
  }
 | 
			
		||||
  CopyCounting& operator=(CopyCounting&& rhs) {
 | 
			
		||||
  CopyCounting& operator=(CopyCounting&& rhs) noexcept {
 | 
			
		||||
    move_count = rhs.move_count + 1;
 | 
			
		||||
    copy_count = rhs.copy_count;
 | 
			
		||||
    return *this;
 | 
			
		||||
@ -175,7 +175,7 @@ namespace test_tuple_map {
 | 
			
		||||
TEST(MetaprogrammingTest, TupleMap_simple) {
 | 
			
		||||
  auto result = tuple_map(
 | 
			
		||||
      std::tuple<int32_t, int32_t, int32_t>(3, 4, 5),
 | 
			
		||||
      [](int32_t a) -> int16_t { return a + 1; });
 | 
			
		||||
      [](int32_t a) -> int16_t { return static_cast<int16_t>(a + 1); });
 | 
			
		||||
  static_assert(
 | 
			
		||||
      std::is_same<std::tuple<int16_t, int16_t, int16_t>, decltype(result)>::
 | 
			
		||||
          value,
 | 
			
		||||
@ -188,7 +188,7 @@ TEST(MetaprogrammingTest, TupleMap_simple) {
 | 
			
		||||
TEST(MetaprogrammingTest, TupleMap_mapperTakesDifferentButConvertibleType) {
 | 
			
		||||
  auto result = tuple_map(
 | 
			
		||||
      std::tuple<int32_t, int32_t, int32_t>(3, 4, 5),
 | 
			
		||||
      [](int64_t a) -> int16_t { return a + 1; });
 | 
			
		||||
      [](int64_t a) -> int16_t { return static_cast<int16_t>(a + 1); });
 | 
			
		||||
  static_assert(
 | 
			
		||||
      std::is_same<std::tuple<int16_t, int16_t, int16_t>, decltype(result)>::
 | 
			
		||||
          value,
 | 
			
		||||
@ -201,7 +201,7 @@ TEST(MetaprogrammingTest, TupleMap_mapperTakesDifferentButConvertibleType) {
 | 
			
		||||
TEST(MetaprogrammingTest, TupleMap_mapperTakesConstRef) {
 | 
			
		||||
  auto result = tuple_map(
 | 
			
		||||
      std::tuple<int32_t, int32_t, int32_t>(3, 4, 5),
 | 
			
		||||
      [](const int32_t& a) -> int16_t { return a + 1; });
 | 
			
		||||
      [](const int32_t& a) -> int16_t { return static_cast<int16_t>(a + 1); });
 | 
			
		||||
  static_assert(
 | 
			
		||||
      std::is_same<std::tuple<int16_t, int16_t, int16_t>, decltype(result)>::
 | 
			
		||||
          value,
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user