Issue 139152
Summary [clang-tidy] Check request: readability-use-format
Labels clang-tidy
Assignees
Reporter denzor200
    
Needs a check that will find a long concatenation chain and will suggest to use `std::format` instead.

BEFORE:
```
std::string message = "Hi " + name + "! You are " + std::to_string(age) +
                      " years old and your height is " +
 std::to_string(static_cast<int>(std::floor(height))) +
 "." + std::to_string(static_cast<int>(100 * (height - std::floor(height)))) + " m.";
```

AFTER:
```
std::string message = std::format(
 "Hi {}! You are {} years old and your height is {}.{} m.", 
        name, age, static_cast<int>(std::floor(height)),
        static_cast<int>(100 * (height - std::floor(height)))
    );
```

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to