Skip to content

Commit d9dc1af

Browse files
g-r-a-n-tGrant  Wuerker
andauthored
clippy (#1110)
Co-authored-by: Grant Wuerker <grantwuerker@pop-os.localdomain>
1 parent ddf590a commit d9dc1af

15 files changed

Lines changed: 27 additions & 24 deletions

File tree

crates/common/src/core.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub struct Core;
1515

1616
pub trait HasBuiltinCore: InputDb {
1717
fn initialize_builtin_core(&mut self);
18-
fn builtin_core(&self) -> Ingot;
18+
fn builtin_core(&self) -> Ingot<'_>;
1919
}
2020

2121
impl<T: InputDb> HasBuiltinCore for T {
@@ -33,7 +33,7 @@ impl<T: InputDb> HasBuiltinCore for T {
3333
}
3434
}
3535

36-
fn builtin_core(&self) -> Ingot {
36+
fn builtin_core(&self) -> Ingot<'_> {
3737
let core = self
3838
.workspace()
3939
.containing_ingot(self, Url::parse(BUILTIN_CORE_BASE_URL).unwrap());

crates/common/src/urlext.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl UrlExt for Url {
4646
// If we're not already at a directory, return the directory
4747
Some(directory)
4848
} else if self.path() == "/" {
49-
return None;
49+
None
5050
} else {
5151
// We're already at a directory, go up one level
5252
let mut parent = self.clone();
@@ -55,7 +55,7 @@ impl UrlExt for Url {
5555
segments.pop();
5656
segments.push(""); // Ensure trailing slash
5757
}
58-
return Some(parent);
58+
Some(parent)
5959
}
6060
}
6161

crates/driver/src/db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl DriverDataBase {
5151
DiagnosticsCollection(pass_manager.run_on_module_tree(self, tree))
5252
}
5353

54-
pub fn top_mod(&self, input: File) -> TopLevelMod {
54+
pub fn top_mod(&self, input: File) -> TopLevelMod<'_> {
5555
map_file_to_mod(self, input)
5656
}
5757
}

crates/hir-analysis/src/name_resolution/name_resolver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ impl<'db> NameRes<'db> {
281281
}
282282
}
283283

284-
pub fn enum_variant(&self) -> Option<EnumVariant> {
284+
pub fn enum_variant(&self) -> Option<EnumVariant<'_>> {
285285
match self.kind {
286286
NameResKind::Scope(ScopeId::Variant(v)) => Some(v),
287287
_ => None,

crates/hir-analysis/src/ty/decision_tree.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ impl<'db> SimplifiedArm<'db> {
309309
}
310310
}
311311

312-
fn pat(&self, col: usize) -> &SimplifiedPattern {
312+
fn pat(&self, col: usize) -> &SimplifiedPattern<'_> {
313313
&self.pat_vec.inner[col]
314314
}
315315

@@ -371,11 +371,11 @@ impl<'db> SimplifiedArmMatrix<'db> {
371371
self.arms[0].pat_vec.len()
372372
}
373373

374-
fn pat(&self, row: usize, col: usize) -> &SimplifiedPattern {
374+
fn pat(&self, row: usize, col: usize) -> &SimplifiedPattern<'_> {
375375
self.arms[row].pat(col)
376376
}
377377

378-
fn reduced_pat_mat(&self, col: usize) -> PatternMatrix {
378+
fn reduced_pat_mat(&self, col: usize) -> PatternMatrix<'_> {
379379
let mut rows = Vec::with_capacity(self.nrows());
380380
for arm in self.arms.iter() {
381381
let reduced_pat_vec = arm

crates/hir-analysis/src/ty/trait_def.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl<'db> TraitEnv<'db> {
169169
}
170170

171171
/// Returns the corresponding implementor of the given `impl Trait` type.
172-
pub(crate) fn map_impl_trait(&self, trait_ref: ImplTrait) -> Option<Binder<Implementor>> {
172+
pub(crate) fn map_impl_trait(&self, trait_ref: ImplTrait) -> Option<Binder<Implementor<'_>>> {
173173
self.hir_to_implementor.get(&trait_ref).copied()
174174
}
175175
}

crates/hir-analysis/src/ty/ty_check/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,7 @@ impl TraitOps for AugAssignOp {
12811281
}
12821282
}
12831283

1284-
fn std_ops_path(db: &dyn HirAnalysisDb) -> PathId {
1284+
fn std_ops_path(db: &dyn HirAnalysisDb) -> PathId<'_> {
12851285
let std_ = IdentId::new(db, "std".to_string());
12861286
let ops_ = IdentId::new(db, "ops".to_string());
12871287
PathId::from_ident(db, std_).push_ident(db, ops_)

crates/hir-analysis/tests/test_db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl HirAnalysisTestDb {
5656
)
5757
}
5858

59-
pub fn top_mod(&self, input: File) -> (TopLevelMod, HirPropertyFormatter) {
59+
pub fn top_mod(&self, input: File) -> (TopLevelMod<'_>, HirPropertyFormatter<'_>) {
6060
let mut prop_formatter = HirPropertyFormatter::default();
6161
let top_mod = self.register_file(&mut prop_formatter, input);
6262
(top_mod, prop_formatter)

crates/hir/src/hir_def/module_tree.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ where
9595

9696
impl ModuleTree<'_> {
9797
/// Returns the tree node data of the given id.
98-
pub fn node_data(&self, id: ModuleTreeNodeId) -> &ModuleTreeNode {
98+
pub fn node_data(&self, id: ModuleTreeNodeId) -> &ModuleTreeNode<'_> {
9999
&self.module_tree.0[id]
100100
}
101101

@@ -105,7 +105,7 @@ impl ModuleTree<'_> {
105105
}
106106

107107
/// Returns the tree node data of the given top level module.
108-
pub fn tree_node_data(&self, top_mod: TopLevelMod) -> &ModuleTreeNode {
108+
pub fn tree_node_data(&self, top_mod: TopLevelMod) -> &ModuleTreeNode<'_> {
109109
&self.module_tree.0[self.tree_node(top_mod)]
110110
}
111111

@@ -114,21 +114,21 @@ impl ModuleTree<'_> {
114114
self.root
115115
}
116116

117-
pub fn root_data(&self) -> &ModuleTreeNode {
117+
pub fn root_data(&self) -> &ModuleTreeNode<'_> {
118118
self.node_data(self.root)
119119
}
120120

121121
/// Returns an iterator of all top level modules in this ingot.
122-
pub fn all_modules(&self) -> impl Iterator<Item = TopLevelMod> + '_ {
122+
pub fn all_modules(&self) -> impl Iterator<Item = TopLevelMod<'_>> + '_ {
123123
self.mod_map.keys().copied()
124124
}
125125

126-
pub fn parent(&self, top_mod: TopLevelMod) -> Option<TopLevelMod> {
126+
pub fn parent(&self, top_mod: TopLevelMod) -> Option<TopLevelMod<'_>> {
127127
let node = self.tree_node_data(top_mod);
128128
node.parent.map(|id| self.module_tree.0[id].top_mod)
129129
}
130130

131-
pub fn children(&self, top_mod: TopLevelMod) -> impl Iterator<Item = TopLevelMod> + '_ {
131+
pub fn children(&self, top_mod: TopLevelMod) -> impl Iterator<Item = TopLevelMod<'_>> + '_ {
132132
self.tree_node_data(top_mod)
133133
.children
134134
.iter()

crates/hir/src/hir_def/prim_ty.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub enum PrimTy {
1212
}
1313

1414
impl PrimTy {
15-
pub fn name(self, db: &dyn HirDb) -> IdentId {
15+
pub fn name(self, db: &dyn HirDb) -> IdentId<'_> {
1616
match self {
1717
PrimTy::Bool => IdentId::make_bool(db),
1818
PrimTy::Int(ty) => ty.name(db),
@@ -55,7 +55,7 @@ pub enum IntTy {
5555
}
5656

5757
impl IntTy {
58-
pub fn name(self, db: &dyn HirDb) -> IdentId {
58+
pub fn name(self, db: &dyn HirDb) -> IdentId<'_> {
5959
match self {
6060
IntTy::I8 => IdentId::make_i8(db),
6161
IntTy::I16 => IdentId::make_i16(db),
@@ -80,7 +80,7 @@ pub enum UintTy {
8080
}
8181

8282
impl UintTy {
83-
pub fn name(self, db: &dyn HirDb) -> IdentId {
83+
pub fn name(self, db: &dyn HirDb) -> IdentId<'_> {
8484
match self {
8585
UintTy::U8 => IdentId::make_u8(db),
8686
UintTy::U16 => IdentId::make_u16(db),

0 commit comments

Comments
 (0)