Skip to content

Commit 7684a2e

Browse files
authored
Merge pull request #1204 from Manishearth/rustup
Rustup to *rustc 1.13.0-nightly (eac4146 2016-08-30)* and bump to 0.0.87
2 parents b38a86a + 377fec7 commit 7684a2e

File tree

11 files changed

+67
-29
lines changed

11 files changed

+67
-29
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4-
## 0.0.87 — ??
4+
## 0.0.87 — 2016-08-31
5+
* Rustup to *rustc 1.13.0-nightly (eac41469d 2016-08-30)*
56
* New lints: [`builtin_type_shadow`]
67
* Fix FP in [`zero_prefixed_literal`] and `0b`/`Oo`
78

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.0.86"
3+
version = "0.0.87"
44
authors = [
55
"Manish Goregaokar <[email protected]>",
66
"Andre Bogus <[email protected]>",
@@ -25,7 +25,7 @@ test = false
2525

2626
[dependencies]
2727
# begin automatic update
28-
clippy_lints = { version = "0.0.86", path = "clippy_lints" }
28+
clippy_lints = { version = "0.0.87", path = "clippy_lints" }
2929
# end automatic update
3030

3131
[dev-dependencies]

clippy_lints/Cargo.toml

Lines changed: 1 addition & 1 deletion
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.86"
4+
version = "0.0.87"
55
# end automatic update
66
authors = [
77
"Manish Goregaokar <[email protected]>",

clippy_lints/src/attrs.rs

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use reexport::*;
44
use rustc::lint::*;
55
use rustc::hir::*;
66
use semver::Version;
7-
use syntax::ast::{Attribute, Lit, LitKind, MetaItemKind};
7+
use syntax::ast::{Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem, NestedMetaItemKind};
88
use syntax::codemap::Span;
99
use utils::{in_macro, match_path, span_lint, span_lint_and_then, snippet_opt};
1010
use utils::paths;
@@ -89,11 +89,13 @@ impl LateLintPass for AttrPass {
8989
return;
9090
}
9191
for item in items {
92-
if let MetaItemKind::NameValue(ref name, ref lit) = item.node {
93-
if name == &"since" {
94-
check_semver(cx, item.span, lit);
95-
}
96-
}
92+
if_let_chain! {[
93+
let NestedMetaItemKind::MetaItem(ref mi) = item.node,
94+
let MetaItemKind::NameValue(ref name, ref lit) = mi.node,
95+
name == &"since",
96+
], {
97+
check_semver(cx, item.span, lit);
98+
}}
9799
}
98100
}
99101
}
@@ -111,11 +113,9 @@ impl LateLintPass for AttrPass {
111113
"allow" | "warn" | "deny" | "forbid" => {
112114
// whitelist `unused_imports`
113115
for lint in lint_list {
114-
if let MetaItemKind::Word(ref word) = lint.node {
115-
if word == "unused_imports" {
116-
if let ItemUse(_) = item.node {
117-
return;
118-
}
116+
if is_word(lint, "unused_imports") {
117+
if let ItemUse(_) = item.node {
118+
return;
119119
}
120120
}
121121
}
@@ -214,10 +214,7 @@ fn check_attrs(cx: &LateContext, span: Span, name: &Name, attrs: &[Attribute]) {
214214
if values.len() != 1 || inline != &"inline" {
215215
continue;
216216
}
217-
if let MetaItemKind::Word(ref always) = values[0].node {
218-
if always != &"always" {
219-
continue;
220-
}
217+
if is_word(&values[0], "always") {
221218
span_lint(cx,
222219
INLINE_ALWAYS,
223220
attr.span,
@@ -239,3 +236,13 @@ fn check_semver(cx: &LateContext, span: Span, lit: &Lit) {
239236
span,
240237
"the since field must contain a semver-compliant version");
241238
}
239+
240+
fn is_word(nmi: &NestedMetaItem, expected: &str) -> bool {
241+
if let NestedMetaItemKind::MetaItem(ref mi) = nmi.node {
242+
if let MetaItemKind::Word(ref word) = mi.node {
243+
return word == expected;
244+
}
245+
}
246+
247+
false
248+
}

clippy_lints/src/derive.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,10 @@ fn check_copy_clone<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, item: &Item, trait_ref
140140
return; // ty is not Copy
141141
}
142142

143-
// Some types are not Clone by default but could be cloned `by hand` if necessary
144143
match ty.sty {
144+
//FIXME:unions: TypeVariants::TyUnion(..) => return,
145+
146+
// Some types are not Clone by default but could be cloned “by hand” if necessary
145147
TypeVariants::TyEnum(def, substs) |
146148
TypeVariants::TyStruct(def, substs) => {
147149
for variant in &def.variants {

clippy_lints/src/len_zero.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ fn has_is_empty(cx: &LateContext, expr: &Expr) -> bool {
209209
}
210210
ty::TyProjection(_) => ty.ty_to_def_id().map_or(false, |id| has_is_empty_impl(cx, &id)),
211211
ty::TyEnum(id, _) |
212-
ty::TyStruct(id, _) => has_is_empty_impl(cx, &id.did),
212+
ty::TyStruct(id, _) /*FIXME:unions: |
213+
ty::TyUnion(id, _)*/ => has_is_empty_impl(cx, &id.did),
213214
ty::TyArray(..) | ty::TyStr => true,
214215
_ => false,
215216
}

clippy_lints/src/missing_doc.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use rustc::hir;
2121
use rustc::lint::*;
2222
use rustc::ty;
2323
use syntax::ast;
24-
use syntax::attr::{self, AttrMetaMethods};
24+
use syntax::attr;
2525
use syntax::codemap::Span;
2626
use utils::in_macro;
2727

@@ -99,7 +99,7 @@ impl LateLintPass for MissingDoc {
9999
let doc_hidden = self.doc_hidden() || attrs.iter().any(|attr| {
100100
attr.check_name("doc") && match attr.meta_item_list() {
101101
None => false,
102-
Some(l) => attr::contains_name(&l[..], "hidden"),
102+
Some(l) => attr::list_contains_name(&l[..], "hidden"),
103103
}
104104
});
105105
self.doc_hidden_stack.push(doc_hidden);
@@ -123,6 +123,7 @@ impl LateLintPass for MissingDoc {
123123
hir::ItemStruct(..) => "a struct",
124124
hir::ItemTrait(..) => "a trait",
125125
hir::ItemTy(..) => "a type alias",
126+
//FIXME:unions: hir::ItemUnion(..) => "a union",
126127
hir::ItemDefaultImpl(..) |
127128
hir::ItemExternCrate(..) |
128129
hir::ItemForeignMod(..) |

clippy_lints/src/unsafe_removed_from_name.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ impl LateLintPass for UnsafeNameRemoval {
5151
ViewPath_::ViewPathList(_, ref path_list_items) => {
5252
for path_list_item in path_list_items.iter() {
5353
let plid = path_list_item.node;
54-
if let (Some(name), Some(rename)) = (plid.name(), plid.rename()) {
55-
unsafe_to_safe_check(name, rename, cx, &item.span);
54+
if let Some(rename) = plid.rename {
55+
unsafe_to_safe_check(plid.name, rename, cx, &item.span);
5656
};
5757
}
5858
}

clippy_lints/src/utils/conf.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
use std::{fmt, fs, io};
66
use std::io::Read;
7-
use syntax::{ast, codemap, ptr};
7+
use syntax::{ast, codemap};
88
use syntax::parse::token;
99
use toml;
1010

1111
/// Get the configuration file from arguments.
12-
pub fn file(args: &[ptr::P<ast::MetaItem>]) -> Result<Option<token::InternedString>, (&'static str, codemap::Span)> {
13-
for arg in args {
12+
pub fn file(args: &[codemap::Spanned<ast::NestedMetaItemKind>]) -> Result<Option<token::InternedString>, (&'static str, codemap::Span)> {
13+
for arg in args.iter().filter_map(|a| a.meta_item()) {
1414
match arg.node {
1515
ast::MetaItemKind::Word(ref name) |
1616
ast::MetaItemKind::List(ref name, _) => {

tests/compile-fail/derive.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#![feature(plugin)]
22
#![plugin(clippy)]
33

4+
//FIXME:unions: #![feature(untagged_unions)]
5+
46
#![deny(warnings)]
57
#![allow(dead_code)]
6-
#![allow(unused_variables)] // Temporary fix for rustc false positive. To be removed.
78

89
use std::hash::{Hash, Hasher};
910

@@ -46,6 +47,22 @@ impl Clone for Qux {
4647
fn clone(&self) -> Self { Qux }
4748
}
4849

50+
/* FIXME:unions
51+
// looks like unions don't support deriving Clone for now
52+
#[derive(Copy)]
53+
union Union {
54+
a: u8,
55+
}
56+
57+
impl Clone for Union {
58+
fn clone(&self) -> Self {
59+
Union {
60+
a: 42,
61+
}
62+
}
63+
}
64+
*/
65+
4966
// See #666
5067
#[derive(Copy)]
5168
struct Lt<'a> {

tests/compile-fail/no_effect.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#![deny(no_effect, unnecessary_operation)]
55
#![allow(dead_code)]
66
#![allow(path_statements)]
7+
//FIXME:unions #![feature(untagged_unions)]
78

89
struct Unit;
910
struct Tuple(i32);
@@ -15,6 +16,13 @@ enum Enum {
1516
Struct { field: i32 },
1617
}
1718

19+
/*FIXME:unions:
20+
union Union {
21+
a: u8,
22+
b: f64,
23+
}
24+
*/
25+
1826
fn get_number() -> i32 { 0 }
1927
fn get_struct() -> Struct { Struct { field: 0 } }
2028

@@ -30,6 +38,7 @@ fn main() {
3038
Tuple(0); //~ERROR statement with no effect
3139
Struct { field: 0 }; //~ERROR statement with no effect
3240
Struct { ..s }; //~ERROR statement with no effect
41+
//FIXME:unions: Union { a: 0 }; // /**FIXME*~***/ ERROR statement with no effect
3342
Enum::Tuple(0); //~ERROR statement with no effect
3443
Enum::Struct { field: 0 }; //~ERROR statement with no effect
3544
5 + 6; //~ERROR statement with no effect

0 commit comments

Comments
 (0)