Skip to content

Commit b7fc905

Browse files
committed
submodules: update clippy from 329923e to 8485d40
Changes: ```` Rustup to rust-lang/rust#69674 Use visit_place Check for mutation Only fires on temporaries Extend `redundant_clone` to the case that cloned value is not consumed add CR feedback Improve documentation Use `edition:2018` flag more widely Update tests/ui/needless_doc_main.rs Move links to the end of each chapter on adding_lints Move links to the end of each chapter on CONTRIBUTING Clean-up adding_lints.md Clean-up CONTRIBUTING.md needless_doc_main: only check rust code Use `node_type_opt` over `node_type` Fix doc Fix ICE with trivial_bounds feature clippy_lints: readme: don't mention crates.io since it is no longer used to publish clippy. update rust-lang.github.io to rustc-dev-guide.rust-lang.org Improve placeholder in map_unit_fn Fix match single binding when in a let stmt Improve error messages for {option,result}_map_unit_fn Mention the setup instructions in CONTRIBUTING redundant_pattern: take binding (ref, ref mut) into account in suggestion. check_pat: delay creation of the "normal" vec until we reach the branch where is is actually needed deps: bump itertools 0.8 -> 0.9 add lint on File::read_to_string and File::read_to_end transition rustc-guide to rustc-dev-guide Rename macro_use_import -> macro_use_imports warn on macro_use attr Fix deploy script for tag deploys ```` Fixes #69957
1 parent 302d2e5 commit b7fc905

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+928
-346
lines changed

.github/deploy.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,17 @@ if git diff --exit-code --quiet; then
3333
exit 0
3434
fi
3535

36-
git add .
37-
git commit -m "Automatic deploy to GitHub Pages: ${SHA}"
36+
if [[ -n $TAG_NAME ]]; then
37+
# Add the new dir
38+
git add $TAG_NAME
39+
# Update the symlink
40+
git add stable
41+
# Update versions file
42+
git add versions.json
43+
git commit -m "Add documentation for ${TAG_NAME} release: ${SHA}"
44+
else
45+
git add .
46+
git commit -m "Automatic deploy to GitHub Pages: ${SHA}"
47+
fi
3848

3949
git push "$SSH_REPO" "$TARGET_BRANCH"

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,7 @@ Released 2018-09-13
12091209
[`linkedlist`]: https://rust-lang.github.io/rust-clippy/master/index.html#linkedlist
12101210
[`logic_bug`]: https://rust-lang.github.io/rust-clippy/master/index.html#logic_bug
12111211
[`lossy_float_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#lossy_float_literal
1212+
[`macro_use_imports`]: https://rust-lang.github.io/rust-clippy/master/index.html#macro_use_imports
12121213
[`main_recursion`]: https://rust-lang.github.io/rust-clippy/master/index.html#main_recursion
12131214
[`manual_memcpy`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_memcpy
12141215
[`manual_saturating_arithmetic`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_saturating_arithmetic
@@ -1416,6 +1417,7 @@ Released 2018-09-13
14161417
[`useless_vec`]: https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec
14171418
[`vec_box`]: https://rust-lang.github.io/rust-clippy/master/index.html#vec_box
14181419
[`verbose_bit_mask`]: https://rust-lang.github.io/rust-clippy/master/index.html#verbose_bit_mask
1420+
[`verbose_file_reads`]: https://rust-lang.github.io/rust-clippy/master/index.html#verbose_file_reads
14191421
[`while_immutable_condition`]: https://rust-lang.github.io/rust-clippy/master/index.html#while_immutable_condition
14201422
[`while_let_loop`]: https://rust-lang.github.io/rust-clippy/master/index.html#while_let_loop
14211423
[`while_let_on_iterator`]: https://rust-lang.github.io/rust-clippy/master/index.html#while_let_on_iterator

CONTRIBUTING.md

Lines changed: 80 additions & 79 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code.
77

8-
[There are 359 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
8+
[There are 361 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
99

1010
We have a bunch of lint categories to allow you to choose how much Clippy is supposed to ~~annoy~~ help you:
1111

clippy_lints/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ edition = "2018"
1919
[dependencies]
2020
cargo_metadata = "0.9.0"
2121
if_chain = "1.0.0"
22-
itertools = "0.8"
22+
itertools = "0.9"
2323
lazy_static = "1.0.2"
2424
matches = "0.1.7"
2525
pulldown-cmark = { version = "0.7", default-features = false }

clippy_lints/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
This crate contains Clippy lints. For the main crate, check
2-
[*crates.io*](https://crates.io/crates/clippy) or
3-
[GitHub](https://github.com/rust-lang/rust-clippy).
1+
This crate contains Clippy lints. For the main crate, check [GitHub](https://github.com/rust-lang/rust-clippy).

clippy_lints/src/attrs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,8 @@ fn is_relevant_impl(cx: &LateContext<'_, '_>, item: &ImplItem<'_>) -> bool {
379379

380380
fn is_relevant_trait(cx: &LateContext<'_, '_>, item: &TraitItem<'_>) -> bool {
381381
match item.kind {
382-
TraitItemKind::Method(_, TraitMethod::Required(_)) => true,
383-
TraitItemKind::Method(_, TraitMethod::Provided(eid)) => {
382+
TraitItemKind::Fn(_, TraitMethod::Required(_)) => true,
383+
TraitItemKind::Fn(_, TraitMethod::Provided(eid)) => {
384384
is_relevant_expr(cx, cx.tcx.body_tables(eid), &cx.tcx.hir().body(eid).value)
385385
},
386386
_ => false,

clippy_lints/src/doc.rs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DocMarkdown {
179179

180180
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::TraitItem<'_>) {
181181
let headers = check_attrs(cx, &self.valid_idents, &item.attrs);
182-
if let hir::TraitItemKind::Method(ref sig, ..) = item.kind {
182+
if let hir::TraitItemKind::Fn(ref sig, ..) = item.kind {
183183
if !in_external_macro(cx.tcx.sess, item.span) {
184184
lint_for_missing_headers(cx, item.hir_id, item.span, sig, headers, None);
185185
}
@@ -367,13 +367,16 @@ fn check_attrs<'a>(cx: &LateContext<'_, '_>, valid_idents: &FxHashSet<String>, a
367367
check_doc(cx, valid_idents, events, &spans)
368368
}
369369

370+
const RUST_CODE: &[&str] = &["rust", "no_run", "should_panic", "compile_fail", "edition2018"];
371+
370372
fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize>)>>(
371373
cx: &LateContext<'_, '_>,
372374
valid_idents: &FxHashSet<String>,
373375
events: Events,
374376
spans: &[(usize, Span)],
375377
) -> DocHeaders {
376378
// true if a safety header was found
379+
use pulldown_cmark::CodeBlockKind;
377380
use pulldown_cmark::Event::{
378381
Code, End, FootnoteReference, HardBreak, Html, Rule, SoftBreak, Start, TaskListMarker, Text,
379382
};
@@ -386,11 +389,20 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
386389
let mut in_code = false;
387390
let mut in_link = None;
388391
let mut in_heading = false;
389-
392+
let mut is_rust = false;
390393
for (event, range) in events {
391394
match event {
392-
Start(CodeBlock(_)) => in_code = true,
393-
End(CodeBlock(_)) => in_code = false,
395+
Start(CodeBlock(ref kind)) => {
396+
in_code = true;
397+
if let CodeBlockKind::Fenced(lang) = kind {
398+
is_rust =
399+
lang.is_empty() || !lang.contains("ignore") && lang.split(',').any(|i| RUST_CODE.contains(&i));
400+
}
401+
},
402+
End(CodeBlock(_)) => {
403+
in_code = false;
404+
is_rust = false;
405+
},
394406
Start(Link(_, url, _)) => in_link = Some(url),
395407
End(Link(..)) => in_link = None,
396408
Start(Heading(_)) => in_heading = true,
@@ -413,7 +425,9 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
413425
};
414426
let (begin, span) = spans[index];
415427
if in_code {
416-
check_code(cx, &text, span);
428+
if is_rust {
429+
check_code(cx, &text, span);
430+
}
417431
} else {
418432
// Adjust for the beginning of the current `Event`
419433
let span = span.with_lo(span.lo() + BytePos::from_usize(range.start - begin));

clippy_lints/src/functions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
273273
}
274274

275275
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::TraitItem<'_>) {
276-
if let hir::TraitItemKind::Method(ref sig, ref eid) = item.kind {
276+
if let hir::TraitItemKind::Fn(ref sig, ref eid) = item.kind {
277277
// don't lint extern functions decls, it's not their fault
278278
if sig.header.abi == Abi::Rust {
279279
self.check_arg_number(cx, &sig.decl, item.span.with_hi(sig.decl.output.span().hi()));

clippy_lints/src/implicit_return.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::utils::{
2-
match_def_path,
2+
fn_has_unsatisfiable_preds, match_def_path,
33
paths::{BEGIN_PANIC, BEGIN_PANIC_FMT},
44
snippet_opt, span_lint_and_then,
55
};
@@ -133,6 +133,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImplicitReturn {
133133
_: HirId,
134134
) {
135135
let def_id = cx.tcx.hir().body_owner_def_id(body.id());
136+
137+
// Building MIR for `fn`s with unsatisfiable preds results in ICE.
138+
if fn_has_unsatisfiable_preds(cx, def_id) {
139+
return;
140+
}
141+
136142
let mir = cx.tcx.optimized_mir(def_id);
137143

138144
// checking return type through MIR, HIR is not able to determine inferred closure return types

0 commit comments

Comments
 (0)