Skip to content

Commit 493c933

Browse files
committed
Apply clippy suggestions after rust update
1 parent f3f468e commit 493c933

File tree

5 files changed

+12
-17
lines changed

5 files changed

+12
-17
lines changed

vhdl_lang/src/analysis/lock.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,13 @@ mod tests {
181181
match lock.entry() {
182182
AnalysisEntry::Occupied(entry) => {
183183
assert_eq!(*entry, 2);
184-
assert!((*entry.result() - 1.0_f64).abs() < std::f64::EPSILON);
184+
assert!((*entry.result() - 1.0_f64).abs() < f64::EPSILON);
185185
}
186186
_ => panic!("Expected Occupied entry"),
187187
};
188188

189189
assert_eq!(*lock.get().unwrap(), 2);
190-
assert!((*lock.get().unwrap().result() - 1.0_f64).abs() < std::f64::EPSILON);
190+
assert!((*lock.get().unwrap().result() - 1.0_f64).abs() < f64::EPSILON);
191191

192192
// Check that lock is reset
193193
lock.reset();

vhdl_lang/src/analysis/names.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ pub enum AttrResolveResult<'a> {
427427

428428
#[derive(Debug)]
429429
pub struct AttributeSuffix<'a> {
430-
pub signature: &'a mut Option<WithTokenSpan<crate::ast::Signature>>,
431430
pub attr: &'a mut WithToken<AttributeDesignator>,
432431
pub expr: &'a mut Option<Box<WithTokenSpan<Expression>>>,
433432
}
@@ -462,7 +461,6 @@ impl<'a> SplitName<'a> {
462461
Name::Attribute(ref mut attr) => SplitName::Suffix(
463462
&mut attr.name,
464463
Suffix::Attribute(AttributeSuffix {
465-
signature: &mut attr.signature,
466464
attr: &mut attr.attr,
467465
expr: &mut attr.expr,
468466
}),

vhdl_lang/src/analysis/range.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,7 @@ impl<'a, 't> AnalyzeContext<'a, 't> {
319319
prefix.as_type_of_attr_prefix(
320320
self.ctx,
321321
name.span,
322-
&AttributeSuffix {
323-
signature,
324-
attr,
325-
expr,
326-
},
322+
&AttributeSuffix { attr, expr },
327323
diagnostics,
328324
)
329325
}),

vhdl_lang/src/named_entity/arena.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ impl LocalArena {
6565

6666
let ent_id = EntityId::new_arena(self.id, LocalId(idx as u32));
6767
ent.id = ent_id;
68-
self.items.push(std::mem::transmute(ent));
68+
self.items
69+
.push(std::mem::transmute::<AnyEnt<'_>, AnyEnt<'_>>(ent));
6970
self.get(ent_id.local_id())
7071
}
7172

vhdl_lang/src/syntax/tokens/tokenizer.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -942,10 +942,10 @@ fn parse_exponent(reader: &mut ContentReader) -> Result<i32, TokenError> {
942942

943943
let exp = parse_integer(reader, 10, false)?;
944944
if negative {
945-
if exp <= (-(i32::min_value() as i64)) as u64 {
945+
if exp <= (-(i32::MIN as i64)) as u64 {
946946
return Ok((-(exp as i64)) as i32);
947947
}
948-
} else if exp <= i32::max_value() as u64 {
948+
} else if exp <= i32::MAX as u64 {
949949
return Ok(exp as i32);
950950
}
951951

@@ -2583,7 +2583,7 @@ comment
25832583
))]
25842584
);
25852585

2586-
let exponent_str = ((i32::max_value() as i64) + 1).to_string();
2586+
let exponent_str = ((i32::MAX as i64) + 1).to_string();
25872587
let large_int = format!("1e{exponent_str}");
25882588
let code = Code::new(&large_int);
25892589
let (tokens, _) = code.tokenize_result();
@@ -2595,7 +2595,7 @@ comment
25952595
))]
25962596
);
25972597

2598-
let exponent_str = ((i32::min_value() as i64) - 1).to_string();
2598+
let exponent_str = ((i32::MIN as i64) - 1).to_string();
25992599
let large_int = format!("1.0e{exponent_str}");
26002600
let code = Code::new(&large_int);
26012601
let (tokens, _) = code.tokenize_result();
@@ -2607,7 +2607,7 @@ comment
26072607
))]
26082608
);
26092609

2610-
let large_int = ((u64::max_value() as i128) + 1).to_string();
2610+
let large_int = ((u64::MAX as i128) + 1).to_string();
26112611
let code = Code::new(&large_int);
26122612
let (tokens, _) = code.tokenize_result();
26132613
assert_eq!(
@@ -2618,14 +2618,14 @@ comment
26182618
))]
26192619
);
26202620

2621-
let large_int = u64::max_value().to_string();
2621+
let large_int = u64::MAX.to_string();
26222622
let code = Code::new(&large_int);
26232623
let (tokens, _) = code.tokenize_result();
26242624
assert_eq!(
26252625
tokens,
26262626
vec![Ok(Token {
26272627
kind: AbstractLiteral,
2628-
value: Value::AbstractLiteral(ast::AbstractLiteral::Integer(u64::max_value())),
2628+
value: Value::AbstractLiteral(ast::AbstractLiteral::Integer(u64::MAX)),
26292629
pos: code.pos(),
26302630
comments: None,
26312631
})]

0 commit comments

Comments
 (0)