================
@@ -43,6 +43,18 @@ void Positives() {
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use a ranges version of this 
algorithm
   // CHECK-FIXES: std::ranges::reverse(I);
 
+  auto LogicalEnd = std::unique(I.begin(), I.end());
+  // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: use a ranges version of this 
algorithm
+  // CHECK-FIXES: auto LogicalEnd = std::ranges::unique(I).begin();
+
+  bool AlreadyUnique = std::unique(I.begin(), I.end()) == I.end();
+  // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: use a ranges version of this 
algorithm
+  // CHECK-FIXES: bool AlreadyUnique = std::ranges::unique(I).begin() == 
I.end();
+
+  std::unique(I.begin(), I.end());
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use a ranges version of this 
algorithm
+  // CHECK-FIXES: std::ranges::unique(I);
+
----------------
zeyi2 wrote:

Could we add another test?

```cpp
auto LogicalEndWithPred = std::unique(I.begin(), I.end(), [](int A, int B) { 
return A == B; });
```

And check it gives fix-its: `std::ranges::unique(I, [](int A, int B) { return A 
== B; }).begin();`

https://github.com/llvm/llvm-project/pull/196035
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to