Skip to content

Commit f1b9ddc

Browse files
committed
Merge remote-tracking branch 'upstream/master' into clippy--all
2 parents 6c66589 + 66346b2 commit f1b9ddc

23 files changed

+839
-454
lines changed

CHANGELOG.md

Lines changed: 215 additions & 210 deletions
Large diffs are not rendered by default.

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ High level approach:
1515

1616
All issues on Clippy are mentored, if you want help with a bug just ask @Manishearth, @llogiq, @mcarton or @oli-obk.
1717

18-
Some issues are easier than others. The [E-easy](https://github.com/Manishearth/rust-clippy/labels/E-easy)
18+
Some issues are easier than others. The [E-easy](https://github.com/rust-lang-nursery/rust-clippy/labels/E-easy)
1919
label can be used to find the easy issues. If you want to work on an issue, please leave a comment
2020
so that we can assign it to you!
2121

22-
Issues marked [T-AST](https://github.com/Manishearth/rust-clippy/labels/T-AST) involve simple
22+
Issues marked [T-AST](https://github.com/rust-lang-nursery/rust-clippy/labels/T-AST) involve simple
2323
matching of the syntax tree structure, and are generally easier than
24-
[T-middle](https://github.com/Manishearth/rust-clippy/labels/T-middle) issues, which involve types
24+
[T-middle](https://github.com/rust-lang-nursery/rust-clippy/labels/T-middle) issues, which involve types
2525
and resolved paths.
2626

27-
Issues marked [E-medium](https://github.com/Manishearth/rust-clippy/labels/E-medium) are generally
27+
Issues marked [E-medium](https://github.com/rust-lang-nursery/rust-clippy/labels/E-medium) are generally
2828
pretty easy too, though it's recommended you work on an E-easy issue first. They are mostly classified
2929
as `E-medium`, since they might be somewhat involved code wise, but not difficult per-se.
3030

@@ -38,7 +38,7 @@ how this syntax structure is encoded in the AST, it is recommended to run `rustc
3838
example of the structure and compare with the
3939
[nodes in the AST docs](http://manishearth.github.io/rust-internals-docs/syntax/ast/). Usually
4040
the lint will end up to be a nested series of matches and ifs,
41-
[like so](https://github.com/Manishearth/rust-clippy/blob/de5ccdfab68a5e37689f3c950ed1532ba9d652a0/src/misc.rs#L34).
41+
[like so](https://github.com/rust-lang-nursery/rust-clippy/blob/de5ccdfab68a5e37689f3c950ed1532ba9d652a0/src/misc.rs#L34).
4242

4343
T-middle issues can be more involved and require verifying types. The
4444
[`ty`](http://manishearth.github.io/rust-internals-docs/rustc/ty) module contains a

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.0.152"
3+
version = "0.0.153"
44
authors = [
55
"Manish Goregaokar <[email protected]>",
66
"Andre Bogus <[email protected]>",
@@ -9,15 +9,15 @@ authors = [
99
"Oliver Schneider <[email protected]>"
1010
]
1111
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
12-
repository = "https://github.com/Manishearth/rust-clippy"
12+
repository = "https://github.com/rust-lang-nursery/rust-clippy"
1313
readme = "README.md"
1414
license = "MPL-2.0"
1515
keywords = ["clippy", "lint", "plugin"]
1616
categories = ["development-tools", "development-tools::cargo-plugins"]
1717

1818
[badges]
19-
travis-ci = { repository = "Manishearth/rust-clippy" }
20-
appveyor = { repository = "Manishearth/rust-clippy" }
19+
travis-ci = { repository = "rust-lang-nursery/rust-clippy" }
20+
appveyor = { repository = "rust-lang-nursery/rust-clippy" }
2121

2222
[lib]
2323
name = "clippy"
@@ -31,7 +31,7 @@ path = "src/main.rs"
3131

3232
[dependencies]
3333
# begin automatic update
34-
clippy_lints = { version = "0.0.152", path = "clippy_lints" }
34+
clippy_lints = { version = "0.0.153", path = "clippy_lints" }
3535
# end automatic update
3636
cargo_metadata = "0.2"
3737

PUBLISH.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Steps to publish a new clippy version
1212
- `git pull`.
1313
- `git tag -s v0.0.X -m "v0.0.X"`.
1414
- `git push --tags`.
15-
- `git clone [email protected]:Manishearth/rust-clippy.wiki.git ../rust-clippy.wiki`
15+
- `git clone [email protected]:rust-lang-nursery/rust-clippy.wiki.git ../rust-clippy.wiki`
1616
- `./util/update_wiki.py`
1717
- `cd ../rust-clippy.wiki`
1818
- `git add *`

README.md

Lines changed: 215 additions & 214 deletions
Large diffs are not rendered by default.

clippy_lints/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "clippy_lints"
33
# begin automatic update
4-
version = "0.0.152"
4+
version = "0.0.153"
55
# end automatic update
66
authors = [
77
"Manish Goregaokar <[email protected]>",
@@ -10,7 +10,7 @@ authors = [
1010
"Martin Carton <[email protected]>"
1111
]
1212
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
13-
repository = "https://github.com/Manishearth/rust-clippy"
13+
repository = "https://github.com/rust-lang-nursery/rust-clippy"
1414
readme = "README.md"
1515
license = "MPL-2.0"
1616
keywords = ["clippy", "lint", "plugin"]

clippy_lints/README.md

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

clippy_lints/src/copies.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ declare_lint! {
6767
/// [using `|`](https://doc.rust-lang.org/book/patterns.html#multiple-patterns).
6868
///
6969
/// **Known problems:** False positive possible with order dependent `match`
70-
/// (see issue [#860](https://github.com/Manishearth/rust-clippy/issues/860)).
70+
/// (see issue [#860](https://github.com/rust-lang-nursery/rust-clippy/issues/860)).
7171
///
7272
/// **Example:**
7373
/// ```rust,ignore

clippy_lints/src/doc.rs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ pub fn strip_doc_comment_decoration(comment: &str, span: Span) -> (String, Vec<(
109109
if comment.starts_with("/*") {
110110
let doc = &comment[3..comment.len() - 2];
111111
let mut sizes = vec![];
112-
112+
let mut contains_initial_stars = false;
113113
for line in doc.lines() {
114114
let offset = line.as_ptr() as usize - comment.as_ptr() as usize;
115115
debug_assert_eq!(offset as u32 as usize, offset);
116-
116+
contains_initial_stars |= line.trim_left().starts_with('*');
117117
// +1 for the newline
118118
sizes.push((
119119
line.len() + 1,
@@ -123,8 +123,25 @@ pub fn strip_doc_comment_decoration(comment: &str, span: Span) -> (String, Vec<(
123123
},
124124
));
125125
}
126-
127-
return (doc.to_string(), sizes);
126+
if !contains_initial_stars {
127+
return (doc.to_string(), sizes);
128+
}
129+
// remove the initial '*'s if any
130+
let mut no_stars = String::with_capacity(doc.len());
131+
for line in doc.lines() {
132+
let mut chars = line.chars();
133+
while let Some(c) = chars.next() {
134+
if c.is_whitespace() {
135+
no_stars.push(c);
136+
} else {
137+
no_stars.push(if c == '*' { ' ' } else { c });
138+
break;
139+
}
140+
}
141+
no_stars.push_str(chars.as_str());
142+
no_stars.push('\n');
143+
}
144+
return (no_stars, sizes);
128145
}
129146

130147
panic!("not a doc-comment: {}", comment);

clippy_lints/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ pub mod unicode;
148148
pub mod unsafe_removed_from_name;
149149
pub mod unused_io_amount;
150150
pub mod unused_label;
151+
pub mod use_self;
151152
pub mod vec;
152153
pub mod zero_div_zero;
153154
// end lints modules, do not remove this comment, it’s used in `update_lints`
@@ -319,6 +320,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
319320
reg.register_late_lint_pass(box should_assert_eq::ShouldAssertEq);
320321
reg.register_late_lint_pass(box needless_pass_by_value::NeedlessPassByValue);
321322
reg.register_early_lint_pass(box literal_digit_grouping::LiteralDigitGrouping);
323+
reg.register_late_lint_pass(box use_self::UseSelf);
322324

323325
reg.register_lint_group("clippy_restrictions", vec![
324326
arithmetic::FLOAT_ARITHMETIC,
@@ -363,6 +365,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
363365
types::INVALID_UPCAST_COMPARISONS,
364366
unicode::NON_ASCII_LITERAL,
365367
unicode::UNICODE_NOT_NFC,
368+
use_self::USE_SELF,
366369
]);
367370

368371
reg.register_lint_group("clippy_internal", vec![

0 commit comments

Comments
 (0)