Skip to content

Commit c6074a9

Browse files
author
Michael Wright
committed
Merge branch 'master' into fix-3078
2 parents daacac6 + 43c629e commit c6074a9

File tree

7 files changed

+114
-214
lines changed

7 files changed

+114
-214
lines changed

Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,5 @@ derive-new = "0.5"
5959
# for more information.
6060
rustc-workspace-hack = "1.0.0"
6161

62-
[build-dependencies]
63-
rustc_version = "0.2.2"
64-
ansi_term = "0.11"
65-
6662
[features]
6763
debugging = []

build.rs

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -13,98 +13,11 @@
1313
//! This build script was originally taken from the Rocket web framework:
1414
//! https://github.com/SergioBenitez/Rocket
1515
16-
use ansi_term::Colour::Red;
17-
use rustc_version::{version_meta, version_meta_for, Channel, Version, VersionMeta};
1816
use std::env;
1917

2018
fn main() {
21-
check_rustc_version();
22-
2319
// Forward the profile to the main compilation
2420
println!("cargo:rustc-env=PROFILE={}", env::var("PROFILE").unwrap());
2521
// Don't rebuild even if nothing changed
2622
println!("cargo:rerun-if-changed=build.rs");
2723
}
28-
29-
fn check_rustc_version() {
30-
let string = include_str!("min_version.txt");
31-
let min_version_meta = version_meta_for(string).expect("Could not parse version string in min_version.txt");
32-
let current_version_meta = version_meta().expect("Could not retrieve current rustc version information from ENV");
33-
34-
let min_version = min_version_meta.clone().semver;
35-
let min_date_str = min_version_meta
36-
.clone()
37-
.commit_date
38-
.expect("min_version.txt does not contain a rustc commit date");
39-
40-
// Dev channel (rustc built from git) does not have any date or commit information in rustc -vV
41-
// `current_version_meta.commit_date` would crash, so we return early here.
42-
if current_version_meta.channel == Channel::Dev {
43-
return;
44-
}
45-
46-
let current_version = current_version_meta.clone().semver;
47-
let current_date_str = current_version_meta
48-
.clone()
49-
.commit_date
50-
.expect("current rustc version information does not contain a rustc commit date");
51-
52-
let print_version_err = |version: &Version, date: &str| {
53-
eprintln!(
54-
"> {} {}. {} {}.\n",
55-
"Installed rustc version is:",
56-
format!("{} ({})", version, date),
57-
"Minimum required rustc version:",
58-
format!("{} ({})", min_version, min_date_str)
59-
);
60-
};
61-
62-
if !correct_channel(&current_version_meta) {
63-
eprintln!(
64-
"\n{} {}",
65-
Red.bold().paint("error:"),
66-
"Clippy requires a nightly version of Rust."
67-
);
68-
print_version_err(&current_version, &*current_date_str);
69-
eprintln!(
70-
"{}{}{}",
71-
"See the README (", "https://github.com/rust-lang-nursery/rust-clippy#usage", ") for more information."
72-
);
73-
panic!("Aborting compilation due to incompatible compiler.")
74-
}
75-
76-
let current_date = str_to_ymd(&current_date_str).unwrap();
77-
let min_date = str_to_ymd(&min_date_str).unwrap();
78-
79-
if current_date < min_date {
80-
eprintln!(
81-
"\n{} {}",
82-
Red.bold().paint("error:"),
83-
"Clippy does not support this version of rustc nightly."
84-
);
85-
eprintln!(
86-
"> {}{}{}",
87-
"Use `", "rustup update", "` or your preferred method to update Rust."
88-
);
89-
print_version_err(&current_version, &*current_date_str);
90-
panic!("Aborting compilation due to incompatible compiler.")
91-
}
92-
}
93-
94-
fn correct_channel(version_meta: &VersionMeta) -> bool {
95-
match version_meta.channel {
96-
Channel::Stable | Channel::Beta => false,
97-
Channel::Nightly | Channel::Dev => true,
98-
}
99-
}
100-
101-
/// Convert a string of %Y-%m-%d to a single u32 maintaining ordering.
102-
fn str_to_ymd(ymd: &str) -> Option<u32> {
103-
let ymd: Vec<u32> = ymd.split("-").filter_map(|s| s.parse::<u32>().ok()).collect();
104-
if ymd.len() != 3 {
105-
return None;
106-
}
107-
108-
let (y, m, d) = (ymd[0], ymd[1], ymd[2]);
109-
Some((y << 9) | (m << 5) | d)
110-
}

clippy_lints/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#![feature(range_contains)]
88
#![allow(unknown_lints, shadow_reuse, missing_docs_in_private_items)]
99
#![recursion_limit = "256"]
10-
#![feature(iterator_find_map)]
1110
#![feature(macro_at_most_once_rep)]
1211
#![warn(rust_2018_idioms)]
1312

@@ -635,6 +634,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
635634
question_mark::QUESTION_MARK,
636635
ranges::ITERATOR_STEP_BY_ZERO,
637636
ranges::RANGE_MINUS_ONE,
637+
ranges::RANGE_PLUS_ONE,
638638
ranges::RANGE_ZIP_WITH_LEN,
639639
redundant_field_names::REDUNDANT_FIELD_NAMES,
640640
reference::DEREF_ADDROF,
@@ -756,7 +756,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
756756
ptr::CMP_NULL,
757757
ptr::PTR_ARG,
758758
question_mark::QUESTION_MARK,
759-
ranges::RANGE_MINUS_ONE,
760759
redundant_field_names::REDUNDANT_FIELD_NAMES,
761760
regex::REGEX_MACRO,
762761
regex::TRIVIAL_REGEX,
@@ -816,6 +815,8 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
816815
overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL,
817816
partialeq_ne_impl::PARTIALEQ_NE_IMPL,
818817
precedence::PRECEDENCE,
818+
ranges::RANGE_MINUS_ONE,
819+
ranges::RANGE_PLUS_ONE,
819820
ranges::RANGE_ZIP_WITH_LEN,
820821
reference::DEREF_ADDROF,
821822
reference::REF_IN_DEREF,
@@ -921,7 +922,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
921922
fallible_impl_from::FALLIBLE_IMPL_FROM,
922923
mutex_atomic::MUTEX_INTEGER,
923924
needless_borrow::NEEDLESS_BORROW,
924-
ranges::RANGE_PLUS_ONE,
925925
unwrap::PANICKING_UNWRAP,
926926
unwrap::UNNECESSARY_UNWRAP,
927927
]);

clippy_lints/src/new_without_default.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::utils::sugg::DiagnosticBuilderExt;
2121
///
2222
/// **Example:**
2323
///
24-
/// ```rust,ignore
24+
/// ```rust
2525
/// struct Foo(Bar);
2626
///
2727
/// impl Foo {
@@ -63,7 +63,7 @@ declare_clippy_lint! {
6363
///
6464
/// **Example:**
6565
///
66-
/// ```rust,ignore
66+
/// ```rust
6767
/// struct Foo;
6868
///
6969
/// impl Foo {

clippy_lints/src/ranges.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ declare_clippy_lint! {
5757
/// ```
5858
declare_clippy_lint! {
5959
pub RANGE_PLUS_ONE,
60-
nursery,
60+
complexity,
6161
"`x..(y+1)` reads better as `x..=y`"
6262
}
6363

@@ -75,7 +75,7 @@ declare_clippy_lint! {
7575
/// ```
7676
declare_clippy_lint! {
7777
pub RANGE_MINUS_ONE,
78-
style,
78+
complexity,
7979
"`x..=(y-1)` reads better as `x..y`"
8080
}
8181

min_version.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)