Skip to content

Commit acdf2e3

Browse files
committed
fix all clippy::use_self pedantic warnings found in the codebase.
cc rust-lang#3172
1 parent cdde22c commit acdf2e3

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

clippy_dev/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ pub struct Lint {
3535
}
3636

3737
impl Lint {
38-
pub fn new(name: &str, group: &str, desc: &str, deprecation: Option<&str>, module: &str) -> Lint {
39-
Lint {
38+
pub fn new(name: &str, group: &str, desc: &str, deprecation: Option<&str>, module: &str) -> Self {
39+
Self {
4040
name: name.to_lowercase(),
4141
group: group.to_string(),
4242
desc: NL_ESCAPE_RE.replace(&desc.replace("\\\"", "\""), "").to_string(),
@@ -46,12 +46,12 @@ impl Lint {
4646
}
4747

4848
/// Returns all non-deprecated lints
49-
pub fn active_lints(lints: &[Lint]) -> impl Iterator<Item=&Lint> {
49+
pub fn active_lints(lints: &[Self]) -> impl Iterator<Item=&Lint> {
5050
lints.iter().filter(|l| l.deprecation.is_none())
5151
}
5252

5353
/// Returns the lints in a HashMap, grouped by the different lint groups
54-
pub fn by_lint_group(lints: &[Lint]) -> HashMap<String, Vec<Lint>> {
54+
pub fn by_lint_group(lints: &[Self]) -> HashMap<String, Vec<Self>> {
5555
lints.iter().map(|lint| (lint.group.to_string(), lint.clone())).into_group_map()
5656
}
5757
}

clippy_lints/src/consts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ impl Constant {
123123
(&Constant::Tuple(ref l), &Constant::Tuple(ref r)) | (&Constant::Vec(ref l), &Constant::Vec(ref r)) => l
124124
.iter()
125125
.zip(r.iter())
126-
.map(|(li, ri)| Constant::partial_cmp(tcx, cmp_type, li, ri))
126+
.map(|(li, ri)| Self::partial_cmp(tcx, cmp_type, li, ri))
127127
.find(|r| r.map_or(true, |o| o != Ordering::Equal))
128128
.unwrap_or_else(|| Some(l.len().cmp(&r.len()))),
129129
(&Constant::Repeat(ref lv, ref ls), &Constant::Repeat(ref rv, ref rs)) => {
130-
match Constant::partial_cmp(tcx, cmp_type, lv, rv) {
130+
match Self::partial_cmp(tcx, cmp_type, lv, rv) {
131131
Some(Equal) => Some(ls.cmp(rs)),
132132
x => x,
133133
}

clippy_lints/src/inherent_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub struct Pass {
4646

4747
impl Default for Pass {
4848
fn default() -> Self {
49-
Pass { impls: FxHashMap::default() }
49+
Self { impls: FxHashMap::default() }
5050
}
5151
}
5252

clippy_lints/src/utils/conf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ define_Conf! {
148148
}
149149

150150
impl Default for Conf {
151-
fn default() -> Conf {
151+
fn default() -> Self {
152152
toml::from_str("").expect("we never error on empty config files")
153153
}
154154
}

0 commit comments

Comments
 (0)