Skip to content

Commit 2375c31

Browse files
committed
Revert "Merge pull request rust-lang#3257 from o01eg/remove-sysroot"
This reverts commit 041c49c, reversing changes made to 278b94e.
1 parent 82e6dbb commit 2375c31

File tree

7 files changed

+15
-24
lines changed

7 files changed

+15
-24
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ rustup update
6666
Once you have rustup and the latest stable release (at least Rust 1.29) installed, run the following command:
6767

6868
```terminal
69-
rustup component add clippy
69+
rustup component add clippy-preview
7070
```
7171

7272
Now you can run Clippy by invoking `cargo clippy`.
@@ -95,7 +95,7 @@ rust:
9595
- stable
9696
- beta
9797
before_script:
98-
- rustup component add clippy
98+
- rustup component add clippy-preview
9999
script:
100100
- cargo clippy
101101
# if you want the build job to fail when encountering warnings, use
@@ -114,7 +114,7 @@ language: rust
114114
rust:
115115
- nightly
116116
before_script:
117-
- rustup component add clippy --toolchain=nightly || cargo install --git https://github.com/rust-lang/rust-clippy/ --force clippy
117+
- rustup component add clippy-preview --toolchain=nightly || cargo install --git https://github.com/rust-lang/rust-clippy/ --force clippy
118118
# etc
119119
```
120120

clippy_lints/src/block_in_if_condition.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl<'a, 'tcx: 'a> Visitor<'tcx> for ExVisitor<'a, 'tcx> {
7070
if let ExprKind::Closure(_, _, eid, _, _) = expr.node {
7171
let body = self.cx.tcx.hir().body(eid);
7272
let ex = &body.value;
73-
if matches!(ex.node, ExprKind::Block(_, _)) && !in_macro(body.value.span) {
73+
if matches!(ex.node, ExprKind::Block(_, _)) {
7474
self.found_block = Some(ex);
7575
return;
7676
}

clippy_lints/src/implicit_return.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ pub struct Pass;
4747
impl Pass {
4848
fn expr_match(cx: &LateContext<'_, '_>, expr: &rustc::hir::Expr) {
4949
match &expr.node {
50-
// loops could be using `break` instead of `return`
51-
ExprKind::Block(block, ..) | ExprKind::Loop(block, ..) => {
50+
ExprKind::Block(block, ..) => {
5251
if let Some(expr) = &block.expr {
5352
Self::expr_match(cx, expr);
5453
}
@@ -86,6 +85,12 @@ impl Pass {
8685
Self::expr_match(cx, &arm.body);
8786
}
8887
},
88+
// loops could be using `break` instead of `return`
89+
ExprKind::Loop(block, ..) => {
90+
if let Some(expr) = &block.expr {
91+
Self::expr_match(cx, expr);
92+
}
93+
},
8994
// skip if it already has a return statement
9095
ExprKind::Ret(..) => (),
9196
// everything else is missing `return`

clippy_lints/src/use_self.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::rustc::ty;
1414
use crate::rustc::{declare_tool_lint, lint_array};
1515
use crate::rustc_errors::Applicability;
1616
use crate::syntax::ast::NodeId;
17-
use crate::syntax_pos::symbol::keywords::SelfUpper;
17+
use crate::syntax_pos::symbol::keywords::SelfType;
1818
use crate::utils::{in_macro, span_lint_and_sugg};
1919
use if_chain::if_chain;
2020

@@ -226,7 +226,7 @@ struct UseSelfVisitor<'a, 'tcx: 'a> {
226226

227227
impl<'a, 'tcx> Visitor<'tcx> for UseSelfVisitor<'a, 'tcx> {
228228
fn visit_path(&mut self, path: &'tcx Path, _id: HirId) {
229-
if self.item_path.def == path.def && path.segments.last().expect(SEGMENTS_MSG).ident.name != SelfUpper.name() {
229+
if self.item_path.def == path.def && path.segments.last().expect(SEGMENTS_MSG).ident.name != SelfType.name() {
230230
span_use_self_lint(self.cx, path);
231231
}
232232

clippy_lints/src/utils/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ pub fn opt_def_id(def: Def) -> Option<DefId> {
971971

972972
pub fn is_self(slf: &Arg) -> bool {
973973
if let PatKind::Binding(_, _, name, _) = slf.pat.node {
974-
name.name == keywords::SelfLower.name()
974+
name.name == keywords::SelfValue.name()
975975
} else {
976976
false
977977
}

tests/ui/block_in_if_condition.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,3 @@ fn condition_is_unsafe_block() {
9898

9999
fn main() {
100100
}
101-
102-
fn macro_in_closure() {
103-
let option = Some(true);
104-
105-
if option.unwrap_or_else(|| unimplemented!()) {
106-
unimplemented!()
107-
}
108-
}

tests/ui/implicit_return.stderr

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ error: missing return statement
3030
38 | true
3131
| ^^^^ help: add `return` as shown: `return true`
3232

33-
error: missing return statement
34-
--> $DIR/implicit_return.rs:46:9
35-
|
36-
46 | break true;
37-
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
38-
3933
error: missing return statement
4034
--> $DIR/implicit_return.rs:52:9
4135
|
@@ -48,5 +42,5 @@ error: missing return statement
4842
54 | let _ = || true;
4943
| ^^^^ help: add `return` as shown: `return true`
5044

51-
error: aborting due to 8 previous errors
45+
error: aborting due to 7 previous errors
5246

0 commit comments

Comments
 (0)