mirror of
https://github.com/rust-lang/rust.git
synced 2026-03-23 18:26:02 +00:00
fix all clippy::use_self pedantic warnings found in the codebase.
cc #3172
This commit is contained in:
@@ -35,8 +35,8 @@ pub struct Lint {
|
||||
}
|
||||
|
||||
impl Lint {
|
||||
pub fn new(name: &str, group: &str, desc: &str, deprecation: Option<&str>, module: &str) -> Lint {
|
||||
Lint {
|
||||
pub fn new(name: &str, group: &str, desc: &str, deprecation: Option<&str>, module: &str) -> Self {
|
||||
Self {
|
||||
name: name.to_lowercase(),
|
||||
group: group.to_string(),
|
||||
desc: NL_ESCAPE_RE.replace(&desc.replace("\\\"", "\""), "").to_string(),
|
||||
@@ -46,12 +46,12 @@ impl Lint {
|
||||
}
|
||||
|
||||
/// Returns all non-deprecated lints
|
||||
pub fn active_lints(lints: &[Lint]) -> impl Iterator<Item=&Lint> {
|
||||
pub fn active_lints(lints: &[Self]) -> impl Iterator<Item=&Self> {
|
||||
lints.iter().filter(|l| l.deprecation.is_none())
|
||||
}
|
||||
|
||||
/// Returns the lints in a HashMap, grouped by the different lint groups
|
||||
pub fn by_lint_group(lints: &[Lint]) -> HashMap<String, Vec<Lint>> {
|
||||
pub fn by_lint_group(lints: &[Self]) -> HashMap<String, Vec<Self>> {
|
||||
lints.iter().map(|lint| (lint.group.to_string(), lint.clone())).into_group_map()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,11 +123,11 @@ impl Constant {
|
||||
(&Constant::Tuple(ref l), &Constant::Tuple(ref r)) | (&Constant::Vec(ref l), &Constant::Vec(ref r)) => l
|
||||
.iter()
|
||||
.zip(r.iter())
|
||||
.map(|(li, ri)| Constant::partial_cmp(tcx, cmp_type, li, ri))
|
||||
.map(|(li, ri)| Self::partial_cmp(tcx, cmp_type, li, ri))
|
||||
.find(|r| r.map_or(true, |o| o != Ordering::Equal))
|
||||
.unwrap_or_else(|| Some(l.len().cmp(&r.len()))),
|
||||
(&Constant::Repeat(ref lv, ref ls), &Constant::Repeat(ref rv, ref rs)) => {
|
||||
match Constant::partial_cmp(tcx, cmp_type, lv, rv) {
|
||||
match Self::partial_cmp(tcx, cmp_type, lv, rv) {
|
||||
Some(Equal) => Some(ls.cmp(rs)),
|
||||
x => x,
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ pub struct Pass {
|
||||
|
||||
impl Default for Pass {
|
||||
fn default() -> Self {
|
||||
Pass { impls: FxHashMap::default() }
|
||||
Self { impls: FxHashMap::default() }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ define_Conf! {
|
||||
}
|
||||
|
||||
impl Default for Conf {
|
||||
fn default() -> Conf {
|
||||
fn default() -> Self {
|
||||
toml::from_str("").expect("we never error on empty config files")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user