Fix syntax highlighting of code fences
The documentation for RESULT_EXPECT_USED includes this code:
let res: Result<usize, ()> = Ok(1);
res?;
# Ok::<(), ()>(())
Because the code fence didn't start with `rust`, the code wasn't highlighted and the line starting with `#` was displayed on the website. This is now fixed.
EDIT: I noticed that highlighting for some other lints is broken as well. It only works if the code fence looks like this:
````markdown
```rust
// ..
```
````
However, many code blocks were ignored. I un-ignored most code blocks and made them compile by adding hidden code with `#`. While doing so, I found two mistakes:
```rust
opt.map_or(None, |a| a + 1)
// instead of
opt.map_or(None, |a| Some(a + 1))
```
and
```rust
fn as_str(self) -> &str
// instead of
fn as_str(self) -> &'static str
```
changelog: none
The documentation for RESULT_EXPECT_USED includes this code:
let res: Result<usize, ()> = Ok(1);
res?;
# Ok::<(), ()>(())
Because the code fence didn't start with `rust`, the code wasn't highlighted and the line starting with `#` was displayed on the website. This is now fixed.
This allows us to use the method in both `fmt.rs` and `lib.rs` in
multiple places. The downside is that we panic inside the method now,
instead of using the error handling in `fmt.rs`. We may want to
centralize the error handling for clippy_dev at some point, though.
If you've been using `./util/dev` before, this now becomes `cargo dev`.
The key part of this change is found in `.cargo/config`.
This means one less shell script and a bit more cross-platform support
for contributors.
add `let_underscore_lock` lint
closes#1574
changelog: add `let_underscore_lock` lint
I am not entirely sure about my docs/messages wording here, improvements are welcome
Clean up `span_lint` in `methods/mod.rs`
Uses `span_help_and_lint` instead of `span_lint` and `span_lint_and_sugg` instead of `span_lint_and_then`.
changelog: none
Don't use ExpnKind::descr to get the name of a bang macro.
This is the same change as the first commit in rust-lang/rust#68407, but applied to clippy.
The new code should work both before and after the changes in rust-lang/rust#68407.
changelog: none
dont fire `possible_missing_comma` if intendation is present
Closes#4399
changelog: dont fire `possible_missing_comma` if intendation is present
I suspect there is already a utils function for indentation (but searching indent didn't yield a function for that), and my solution is certainly not universal, but it's probably the best we can do.