Skip to content

Commit e8390a0

Browse files
committed
chore: Fix errors reported by clippy beta
This fixes errors like error: the following explicit lifetimes could be elided: 'a error: empty line after doc comment error: unneeded `return` statement
1 parent 6c93608 commit e8390a0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+183
-197
lines changed

core/src/avm1/activation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ macro_rules! avm_debug {
4545
#[derive(Clone)]
4646
pub struct RegisterSet<'gc>(SmallVec<[Value<'gc>; 8]>);
4747

48-
unsafe impl<'gc> gc_arena::Collect for RegisterSet<'gc> {
48+
unsafe impl gc_arena::Collect for RegisterSet<'_> {
4949
#[inline]
5050
fn trace(&self, cc: &gc_arena::Collection) {
5151
for register in &self.0 {

core/src/avm1/function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ impl<'gc> Executable<'gc> {
457457
}
458458
}
459459

460-
impl<'gc> From<NativeFunction> for Executable<'gc> {
460+
impl From<NativeFunction> for Executable<'_> {
461461
fn from(nf: NativeFunction) -> Self {
462462
Executable::Native(nf)
463463
}

core/src/avm1/property_map.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl<'gc, V> PropertyMap<'gc, V> {
108108
}
109109
}
110110

111-
unsafe impl<'gc, V: Collect> Collect for PropertyMap<'gc, V> {
111+
unsafe impl<V: Collect> Collect for PropertyMap<'_, V> {
112112
fn trace(&self, cc: &gc_arena::Collection) {
113113
for (key, value) in &self.0 {
114114
key.0.trace(cc);
@@ -127,7 +127,7 @@ pub struct OccupiedEntry<'gc, 'a, V> {
127127
index: usize,
128128
}
129129

130-
impl<'gc, 'a, V> OccupiedEntry<'gc, 'a, V> {
130+
impl<'gc, V> OccupiedEntry<'gc, '_, V> {
131131
pub fn remove_entry(&mut self) -> (AvmString<'gc>, V) {
132132
let (k, v) = self.map.shift_remove_index(self.index).unwrap();
133133
(k.0, v)
@@ -151,7 +151,7 @@ pub struct VacantEntry<'gc, 'a, V> {
151151
key: AvmString<'gc>,
152152
}
153153

154-
impl<'gc, 'a, V> VacantEntry<'gc, 'a, V> {
154+
impl<V> VacantEntry<'_, '_, V> {
155155
pub fn insert(self, value: V) {
156156
self.map.insert(PropertyName(self.key), value);
157157
}
@@ -160,13 +160,13 @@ impl<'gc, 'a, V> VacantEntry<'gc, 'a, V> {
160160
/// Wraps a str-like type, causing the hash map to use a case insensitive hash and equality.
161161
struct CaseInsensitive<T>(T);
162162

163-
impl<'a> Hash for CaseInsensitive<&'a WStr> {
163+
impl Hash for CaseInsensitive<&WStr> {
164164
fn hash<H: Hasher>(&self, state: &mut H) {
165165
swf_hash_string_ignore_case(self.0, state);
166166
}
167167
}
168168

169-
impl<'gc, 'a> Equivalent<PropertyName<'gc>> for CaseInsensitive<&'a WStr> {
169+
impl<'gc> Equivalent<PropertyName<'gc>> for CaseInsensitive<&WStr> {
170170
fn equivalent(&self, key: &PropertyName<'gc>) -> bool {
171171
key.0.eq_ignore_case(self.0)
172172
}
@@ -176,13 +176,13 @@ impl<'gc, 'a> Equivalent<PropertyName<'gc>> for CaseInsensitive<&'a WStr> {
176176
/// but case sensitive equality.
177177
struct CaseSensitive<T>(T);
178178

179-
impl<'a> Hash for CaseSensitive<&'a WStr> {
179+
impl Hash for CaseSensitive<&WStr> {
180180
fn hash<H: Hasher>(&self, state: &mut H) {
181181
swf_hash_string_ignore_case(self.0, state);
182182
}
183183
}
184184

185-
impl<'gc, 'a> Equivalent<PropertyName<'gc>> for CaseSensitive<&'a WStr> {
185+
impl<'gc> Equivalent<PropertyName<'gc>> for CaseSensitive<&WStr> {
186186
fn equivalent(&self, key: &PropertyName<'gc>) -> bool {
187187
key.0 == self.0
188188
}
@@ -198,7 +198,7 @@ impl<'gc, 'a> Equivalent<PropertyName<'gc>> for CaseSensitive<&'a WStr> {
198198
struct PropertyName<'gc>(AvmString<'gc>);
199199

200200
#[allow(clippy::derive_hash_xor_eq)]
201-
impl<'gc> Hash for PropertyName<'gc> {
201+
impl Hash for PropertyName<'_> {
202202
fn hash<H: Hasher>(&self, state: &mut H) {
203203
swf_hash_string_ignore_case(self.0.as_ref(), state);
204204
}

core/src/avm1/value.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ impl<'gc> From<AvmAtom<'gc>> for Value<'gc> {
4747
}
4848
}
4949

50-
impl<'gc> From<&'static str> for Value<'gc> {
50+
impl From<&'static str> for Value<'_> {
5151
fn from(string: &'static str) -> Self {
5252
Value::String(string.into())
5353
}
5454
}
5555

56-
impl<'gc> From<bool> for Value<'gc> {
56+
impl From<bool> for Value<'_> {
5757
fn from(value: bool) -> Self {
5858
Value::Bool(value)
5959
}
@@ -68,61 +68,61 @@ where
6868
}
6969
}
7070

71-
impl<'gc> From<f64> for Value<'gc> {
71+
impl From<f64> for Value<'_> {
7272
fn from(value: f64) -> Self {
7373
Value::Number(value)
7474
}
7575
}
7676

77-
impl<'gc> From<f32> for Value<'gc> {
77+
impl From<f32> for Value<'_> {
7878
fn from(value: f32) -> Self {
7979
Value::Number(f64::from(value))
8080
}
8181
}
8282

83-
impl<'gc> From<i8> for Value<'gc> {
83+
impl From<i8> for Value<'_> {
8484
fn from(value: i8) -> Self {
8585
Value::Number(f64::from(value))
8686
}
8787
}
8888

89-
impl<'gc> From<u8> for Value<'gc> {
89+
impl From<u8> for Value<'_> {
9090
fn from(value: u8) -> Self {
9191
Value::Number(f64::from(value))
9292
}
9393
}
9494

95-
impl<'gc> From<i16> for Value<'gc> {
95+
impl From<i16> for Value<'_> {
9696
fn from(value: i16) -> Self {
9797
Value::Number(f64::from(value))
9898
}
9999
}
100100

101-
impl<'gc> From<u16> for Value<'gc> {
101+
impl From<u16> for Value<'_> {
102102
fn from(value: u16) -> Self {
103103
Value::Number(f64::from(value))
104104
}
105105
}
106106

107-
impl<'gc> From<i32> for Value<'gc> {
107+
impl From<i32> for Value<'_> {
108108
fn from(value: i32) -> Self {
109109
Value::Number(f64::from(value))
110110
}
111111
}
112112

113-
impl<'gc> From<u32> for Value<'gc> {
113+
impl From<u32> for Value<'_> {
114114
fn from(value: u32) -> Self {
115115
Value::Number(f64::from(value))
116116
}
117117
}
118118

119-
impl<'gc> From<u64> for Value<'gc> {
119+
impl From<u64> for Value<'_> {
120120
fn from(value: u64) -> Self {
121121
Value::Number(value as f64)
122122
}
123123
}
124124

125-
impl<'gc> From<usize> for Value<'gc> {
125+
impl From<usize> for Value<'_> {
126126
fn from(value: usize) -> Self {
127127
Value::Number(value as f64)
128128
}

core/src/avm2/activation.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,9 @@ use super::error::make_mismatch_error;
3636
/// Represents a particular register set.
3737
///
3838
/// This type exists primarily because SmallVec isn't garbage-collectable.
39-
4039
pub struct RegisterSet<'gc>(SmallVec<[Value<'gc>; 8]>);
4140

42-
unsafe impl<'gc> gc_arena::Collect for RegisterSet<'gc> {
41+
unsafe impl gc_arena::Collect for RegisterSet<'_> {
4342
#[inline]
4443
fn trace(&self, cc: &gc_arena::Collection) {
4544
for register in &self.0 {

core/src/avm2/array.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct ArrayStorageIterator<'a, 'gc> {
3434
index_back: usize,
3535
}
3636

37-
impl<'a, 'gc> Iterator for ArrayStorageIterator<'a, 'gc> {
37+
impl<'gc> Iterator for ArrayStorageIterator<'_, 'gc> {
3838
type Item = Option<Value<'gc>>;
3939

4040
fn next(&mut self) -> Option<Self::Item> {
@@ -51,7 +51,7 @@ impl<'a, 'gc> Iterator for ArrayStorageIterator<'a, 'gc> {
5151
}
5252
}
5353

54-
impl<'a, 'gc> DoubleEndedIterator for ArrayStorageIterator<'a, 'gc> {
54+
impl DoubleEndedIterator for ArrayStorageIterator<'_, '_> {
5555
fn next_back(&mut self) -> Option<Self::Item> {
5656
if self.index >= self.index_back || self.index_back == 0 {
5757
None
@@ -66,7 +66,7 @@ impl<'a, 'gc> DoubleEndedIterator for ArrayStorageIterator<'a, 'gc> {
6666
}
6767
}
6868

69-
impl<'a, 'gc> ExactSizeIterator for ArrayStorageIterator<'a, 'gc> {
69+
impl ExactSizeIterator for ArrayStorageIterator<'_, '_> {
7070
fn len(&self) -> usize {
7171
self.index_back - self.index
7272
}
@@ -139,9 +139,7 @@ impl<'gc> ArrayStorage<'gc> {
139139
/// yielding `None`.
140140
pub fn get(&self, item: usize) -> Option<Value<'gc>> {
141141
match &self {
142-
ArrayStorage::Dense { storage, .. } => {
143-
return storage.get(item).copied().unwrap_or(None);
144-
}
142+
ArrayStorage::Dense { storage, .. } => storage.get(item).copied().unwrap_or(None),
145143
ArrayStorage::Sparse { storage, .. } => storage.get(&item).copied(),
146144
}
147145
}

core/src/avm2/call_stack.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ impl<'gc> CallStack<'gc> {
6969
}
7070
}
7171

72-
impl<'gc> Default for CallStack<'gc> {
72+
impl Default for CallStack<'_> {
7373
fn default() -> Self {
7474
Self::new()
7575
}
7676
}
7777

78-
impl<'gc> std::fmt::Display for CallStack<'gc> {
78+
impl std::fmt::Display for CallStack<'_> {
7979
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8080
let mut output = WString::new();
8181
self.display(&mut output);

core/src/avm2/class.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ impl Hash for Class<'_> {
199199
}
200200
}
201201

202-
impl<'gc> core::fmt::Debug for Class<'gc> {
202+
impl core::fmt::Debug for Class<'_> {
203203
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
204204
f.debug_struct("Class").field("name", &self.name()).finish()
205205
}

core/src/avm2/domain.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,10 @@ impl<'gc> Domain<'gc> {
427427

428428
pub enum DomainPtr {}
429429

430-
impl<'gc> PartialEq for Domain<'gc> {
430+
impl PartialEq for Domain<'_> {
431431
fn eq(&self, other: &Self) -> bool {
432432
self.0.as_ptr() == other.0.as_ptr()
433433
}
434434
}
435435

436-
impl<'gc> Eq for Domain<'gc> {}
436+
impl Eq for Domain<'_> {}

core/src/avm2/e4x.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub struct E4XNodeData<'gc> {
4242
notification: Option<FunctionObject<'gc>>,
4343
}
4444

45-
impl<'gc> Debug for E4XNodeData<'gc> {
45+
impl Debug for E4XNodeData<'_> {
4646
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4747
f.debug_struct("E4XNodeData")
4848
// Don't print the actual parent, to avoid infinite recursion
@@ -1392,16 +1392,16 @@ impl<'gc> E4XNode<'gc> {
13921392
);
13931393
}
13941394

1395-
return to_xml_string(E4XOrXml::E4X(*self), activation);
1395+
to_xml_string(E4XOrXml::E4X(*self), activation)
13961396
}
13971397
E4XNodeKind::Comment(_) | E4XNodeKind::ProcessingInstruction(_) => {
1398-
return to_xml_string(E4XOrXml::E4X(*self), activation);
1398+
to_xml_string(E4XOrXml::E4X(*self), activation)
13991399
}
14001400
}
14011401
}
14021402

14031403
pub fn xml_to_xml_string(&self, activation: &mut Activation<'_, 'gc>) -> AvmString<'gc> {
1404-
return to_xml_string(E4XOrXml::E4X(*self), activation);
1404+
to_xml_string(E4XOrXml::E4X(*self), activation)
14051405
}
14061406

14071407
pub fn kind(&self) -> Ref<'_, E4XNodeKind<'gc>> {

core/src/avm2/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub enum Error<'gc> {
2222
RustError(Box<dyn std::error::Error>),
2323
}
2424

25-
impl<'gc> Debug for Error<'gc> {
25+
impl Debug for Error<'_> {
2626
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2727
if let Error::AvmError(error) = self {
2828
if let Some(error) = error.as_object().and_then(|obj| obj.as_error_object()) {
@@ -836,7 +836,7 @@ fn error_constructor<'gc>(
836836
.into())
837837
}
838838

839-
impl<'gc> std::fmt::Display for Error<'gc> {
839+
impl std::fmt::Display for Error<'_> {
840840
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
841841
write!(f, "{self:?}")
842842
}

core/src/avm2/events.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl<'gc> DispatchList<'gc> {
303303
}
304304
}
305305

306-
impl<'gc> Default for DispatchList<'gc> {
306+
impl Default for DispatchList<'_> {
307307
fn default() -> Self {
308308
Self::new()
309309
}
@@ -331,15 +331,15 @@ impl<'gc> EventHandler<'gc> {
331331
}
332332
}
333333

334-
impl<'gc> PartialEq for EventHandler<'gc> {
334+
impl PartialEq for EventHandler<'_> {
335335
fn eq(&self, rhs: &Self) -> bool {
336336
self.use_capture == rhs.use_capture && Object::ptr_eq(self.handler, rhs.handler)
337337
}
338338
}
339339

340-
impl<'gc> Eq for EventHandler<'gc> {}
340+
impl Eq for EventHandler<'_> {}
341341

342-
impl<'gc> Hash for EventHandler<'gc> {
342+
impl Hash for EventHandler<'_> {
343343
fn hash<H: Hasher>(&self, state: &mut H) {
344344
self.use_capture.hash(state);
345345
self.handler.as_ptr().hash(state);

core/src/avm2/function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ pub fn exec<'gc>(
253253
ret
254254
}
255255

256-
impl<'gc> fmt::Debug for BoundMethod<'gc> {
256+
impl fmt::Debug for BoundMethod<'_> {
257257
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
258258
match self.method {
259259
Method::Bytecode(be) => fmt

core/src/avm2/globals/flash/system/security.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub fn get_sandbox_type<'gc>(
4949
SandboxType::LocalTrusted => "localTrusted",
5050
SandboxType::Application => "application",
5151
};
52-
return Ok(AvmString::new_utf8(activation.context.gc_context, sandbox_type).into());
52+
Ok(AvmString::new_utf8(activation.context.gc_context, sandbox_type).into())
5353
}
5454

5555
pub fn allow_domain<'gc>(

core/src/avm2/globals/reg_exp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub fn call_handler<'gc>(
7474
return Ok(arg);
7575
}
7676
}
77-
return this_class.construct(activation, args).map(|o| o.into());
77+
this_class.construct(activation, args).map(|o| o.into())
7878
}
7979

8080
/// Implements `RegExp.dotall`

0 commit comments

Comments
 (0)