Skip to content

Commit 77b14e5

Browse files
committed
chore: Fix new clippy warnings
1 parent 790b52e commit 77b14e5

File tree

15 files changed

+37
-45
lines changed

15 files changed

+37
-45
lines changed

dedup/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub trait DeduplicateConstants: Sized {
1313
fn deduplicate_constants(self) -> Result<Self, Error>;
1414
}
1515

16-
impl<'ast> DeduplicateConstants for Fir<FlattenData<'ast>> {
16+
impl DeduplicateConstants for Fir<FlattenData<'_>> {
1717
fn deduplicate_constants(self) -> Result<Self, Error> {
1818
let mut ctx = ConstantDeduplicator(HashMap::new());
1919

flatten/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ pub enum AstInfo<'ast> {
193193
Helper(Symbol, SpanTuple),
194194
}
195195

196-
impl<'ast> AstInfo<'ast> {
196+
impl AstInfo<'_> {
197197
pub fn location(&self) -> &SpanTuple {
198198
match self {
199199
AstInfo::Node(Ast { location, .. })

name_resolve/src/declarator.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ enum DefinitionKind {
1212

1313
pub(crate) struct Declarator<'ctx, 'enclosing>(pub(crate) &'ctx mut NameResolveCtx<'enclosing>);
1414

15-
impl<'ctx, 'enclosing> Declarator<'ctx, 'enclosing> {
15+
impl Declarator<'_, '_> {
1616
fn define(
1717
&mut self,
1818
kind: DefinitionKind,
@@ -41,9 +41,7 @@ impl<'ctx, 'enclosing> Declarator<'ctx, 'enclosing> {
4141
}
4242
}
4343

44-
impl<'ast, 'ctx, 'enclosing> Traversal<FlattenData<'ast>, NameResolutionError>
45-
for Declarator<'ctx, 'enclosing>
46-
{
44+
impl<'ast> Traversal<FlattenData<'ast>, NameResolutionError> for Declarator<'_, '_> {
4745
// TODO: Can we factor these three functions?
4846

4947
fn traverse_function(

name_resolve/src/lib.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl<'scope, 'enclosing> LookupIterator<'scope, 'enclosing> for FlatScope<'enclo
109109
}
110110
}
111111

112-
impl<'scope, 'enclosing> Iterator for FlatIterator<'scope, 'enclosing> {
112+
impl<'scope> Iterator for FlatIterator<'scope, '_> {
113113
type Item = &'scope Bindings;
114114

115115
fn next(&mut self) -> Option<Self::Item> {
@@ -125,7 +125,7 @@ impl<'scope, 'enclosing> Iterator for FlatIterator<'scope, 'enclosing> {
125125
}
126126
}
127127

128-
impl<'enclosing> FlatScope<'enclosing> {
128+
impl FlatScope<'_> {
129129
fn lookup(&self, name: &Symbol, starting_scope: Scope) -> Option<&OriginIdx> {
130130
self.lookup_iterator(starting_scope)
131131
.find_map(|bindings| bindings.get(name))
@@ -163,7 +163,7 @@ struct NameResolveCtx<'enclosing> {
163163
}
164164

165165
impl<'enclosing> NameResolveCtx<'enclosing> {
166-
fn new(enclosing_scope: EnclosingScope<'enclosing>) -> NameResolveCtx {
166+
fn new(enclosing_scope: EnclosingScope<'enclosing>) -> NameResolveCtx<'enclosing> {
167167
let empty_scope_map: HashMap<Scope, Bindings> = enclosing_scope
168168
.0
169169
.values()
@@ -314,7 +314,7 @@ impl NameResolutionError {
314314
}
315315
}
316316

317-
impl<'enclosing> NameResolveCtx<'enclosing> {
317+
impl NameResolveCtx<'_> {
318318
fn scope(fir: &Fir<FlattenData>) -> HashMap<OriginIdx, Scope> {
319319
let root = fir.nodes.last_key_value().unwrap();
320320

@@ -346,9 +346,7 @@ impl<'enclosing> NameResolveCtx<'enclosing> {
346346
}
347347
}
348348

349-
impl<'ast, 'enclosing> Pass<FlattenData<'ast>, FlattenData<'ast>, Error>
350-
for NameResolveCtx<'enclosing>
351-
{
349+
impl<'ast> Pass<FlattenData<'ast>, FlattenData<'ast>, Error> for NameResolveCtx<'_> {
352350
fn pre_condition(_fir: &Fir<FlattenData>) {}
353351

354352
fn post_condition(_fir: &Fir<FlattenData>) {}

name_resolve/src/resolver.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl Display for ResolveKind {
2626

2727
pub(crate) struct Resolver<'ctx, 'enclosing>(pub(crate) &'ctx mut NameResolveCtx<'enclosing>);
2828

29-
impl<'ctx, 'enclosing> Resolver<'ctx, 'enclosing> {
29+
impl Resolver<'_, '_> {
3030
fn get_definition(
3131
&self,
3232
kind: ResolveKind,
@@ -54,9 +54,7 @@ impl<'ctx, 'enclosing> Resolver<'ctx, 'enclosing> {
5454
}
5555
}
5656

57-
impl<'ast, 'ctx, 'enclosing> Mapper<FlattenData<'ast>, FlattenData<'ast>, NameResolutionError>
58-
for Resolver<'ctx, 'enclosing>
59-
{
57+
impl<'ast> Mapper<FlattenData<'ast>, FlattenData<'ast>, NameResolutionError> for Resolver<'_, '_> {
6058
fn map_call(
6159
&mut self,
6260
data: FlattenData<'ast>,

src/context/scope_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl<V, F, T> ScopeMap<V, F, T> {
8787
&'map self,
8888
key: &Q,
8989
map_extractor: impl Fn(&Scope<V, F, T>) -> &HashMap<K, U>,
90-
) -> Option<&U>
90+
) -> Option<&'map U>
9191
where
9292
K: Borrow<Q> + Hash + Eq + 'map,
9393
Q: Hash + Eq + ?Sized,

src/ffi.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ mod tests {
248248
let call = call.downcast_ref::<FunctionCall>().unwrap();
249249

250250
assert_eq!(
251-
execute(&dec, &call, &mut i),
251+
execute(dec, call, &mut i),
252252
Ok(Some(JkInt::from(15).to_instance()))
253253
);
254254
}
@@ -264,12 +264,12 @@ mod tests {
264264
let call = constructs::expr(span!("print_something()")).unwrap().1;
265265
let call = call.downcast_ref::<FunctionCall>().unwrap();
266266

267-
assert_eq!(execute(&dec, &call, &mut i), Ok(None));
267+
assert_eq!(execute(dec, call, &mut i), Ok(None));
268268
}
269269

270270
#[test]
271271
fn load_libs_stress() {
272-
let ld_library_path = std::env::var("LD_LIBRARY_PATH").unwrap_or(String::new());
272+
let ld_library_path = std::env::var("LD_LIBRARY_PATH").unwrap_or_default();
273273
let pwd = std::env::var("PWD").unwrap();
274274
std::env::set_var(
275275
"LD_LIBRARY_PATH",

src/instruction/binary_op.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ mod tests {
268268
fn comparison_precedence() {
269269
assert_bool(
270270
"1 + 4 * 2 - 1 + 2 * (14 + (2 - 17) * 1) - 12 + 3 / 2 < 45",
271-
1 + 4 * 2 - 1 + 2 * (14 + (2 - 17) * 1) - 12 + 3 / 2 < 45,
271+
1 + 4 * 2 - 1 + 2 * (14 + (2 - 17)) - 12 + 3 / 2 < 45,
272272
);
273273
}
274274

@@ -375,17 +375,17 @@ mod tests {
375375

376376
#[test]
377377
fn binop_execute_valid_mul() {
378-
binop_assert!(1 * 2);
378+
binop_assert!(2);
379379
}
380380

381381
#[test]
382382
fn binop_execute_valid_normal_priority() {
383-
binop_assert!(1 * 2 + 3);
383+
binop_assert!(2 + 3);
384384
}
385385

386386
#[test]
387387
fn binop_execute_valid_back_priority() {
388-
binop_assert!(3 + 1 * 2);
388+
binop_assert!(3 + 2);
389389
}
390390

391391
#[test]
@@ -410,6 +410,6 @@ mod tests {
410410

411411
#[test]
412412
fn binop_execute_valid_extremely_complex_expr() {
413-
binop_assert!(1 + 4 * 2 - 1 + 2 * (14 + (2 - 17) * 1) - 12 + 3 / 2);
413+
binop_assert!(1 + 4 * 2 - 1 + 2 * (14 + (2 - 17)) - 12 + 3 / 2);
414414
}
415415
}

src/instruction/field_access.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,11 @@ mod tests {
134134
use crate::{jinko, jinko_fail, span};
135135

136136
fn setup() -> Context {
137-
let ctx = jinko! {
137+
jinko! {
138138
type Point(x: int, y:int);
139139
func basic() -> Point { Point ( x : 15, y : 14 )}
140140
b = basic();
141-
};
142-
143-
ctx
141+
}
144142
}
145143

146144
#[test]

src/parser/constructs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -759,9 +759,9 @@ fn generic_func_or_type_inst_args(
759759
func_or_type_inst_args(next(input), id, generics, start_loc)
760760
}
761761

762-
///
763-
/// ARGS
764-
///
762+
//
763+
// ARGS
764+
//
765765

766766
/// args = expr ( ',' expr )* ')'
767767
/// | ')'

0 commit comments

Comments
 (0)