diff options
| author | bors <bors@rust-lang.org> | 2020-11-20 03:40:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-11-20 03:40:20 +0000 |
| commit | 74285eb3a83eac639f9c54ba8c4ccf9879b3b00a (patch) | |
| tree | 6771c2444c7ce708f710b7649875c81754c56fe6 /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp | |
| parent | 4ec27e4b79891b0ebc2ad71a3c4ac94f67d93f93 (diff) | |
| parent | a125ef2e8ec27e8fedc119ddfdef638d09a69ba2 (diff) | |
| download | rust-74285eb3a83eac639f9c54ba8c4ccf9879b3b00a.tar.gz rust-74285eb3a83eac639f9c54ba8c4ccf9879b3b00a.zip | |
Auto merge of #78088 - fusion-engineering-forks:panic-fmt-lint, r=estebank
Add lint for panic!("{}")
This adds a lint that warns about `panic!("{}")`.
`panic!(msg)` invocations with a single argument use their argument as panic payload literally, without using it as a format string. The same holds for `assert!(expr, msg)`.
This lints checks if `msg` is a string literal (after expansion), and warns in case it contained braces. It suggests to insert `"{}", ` to use the message literally, or to add arguments to use it as a format string.

This lint is also a good starting point for adding warnings about `panic!(not_a_string)` later, once [`panic_any()`](https://github.com/rust-lang/rust/pull/74622) becomes a stable alternative.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
