Skip to content

Commit b2a25c3

Browse files
authored
Enable the clippy::multiple_bound_locations lint (#11404)
This opts-in to a new Clippy lint which is intended to help clean up historical refactorings to ensure that bounds on type parameters are either in the type parameter declaration or in a `where` clause, but not both.
1 parent a77423f commit b2a25c3

4 files changed

Lines changed: 12 additions & 10 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ unnecessary_cast = 'warn'
216216
allow_attributes_without_reason = 'warn'
217217
from_over_into = 'warn'
218218
redundant_field_names = 'warn'
219+
multiple_bound_locations = 'warn'
219220

220221
[workspace.dependencies]
221222
# Public crates related to Wasmtime.

cranelift/entity/src/set.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ where
2323
unused: PhantomData<K>,
2424
}
2525

26-
impl<K: fmt::Debug> fmt::Debug for EntitySet<K>
26+
impl<K> fmt::Debug for EntitySet<K>
2727
where
28-
K: EntityRef,
28+
K: fmt::Debug + EntityRef,
2929
{
3030
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3131
f.debug_set().entries(self.keys()).finish()

crates/wasmtime/src/runtime/component/concurrent.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2500,7 +2500,7 @@ impl Instance {
25002500
/// it an `&Accessor<T>`.
25012501
///
25022502
/// See the `Accessor` documentation for details.
2503-
pub(crate) fn wrap_call<T: 'static, F, R>(
2503+
pub(crate) fn wrap_call<T, F, R>(
25042504
self,
25052505
store: StoreContextMut<T>,
25062506
closure: F,

crates/wasmtime/src/runtime/component/func/host.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ enum HostResult<T> {
4040
}
4141

4242
impl HostFunc {
43-
fn from_canonical<T: 'static, F, P, R>(func: F) -> Arc<HostFunc>
43+
fn from_canonical<T, F, P, R>(func: F) -> Arc<HostFunc>
4444
where
4545
F: Fn(StoreContextMut<'_, T>, Instance, P) -> HostResult<R> + Send + Sync + 'static,
4646
P: ComponentNamedList + Lift + 'static,
@@ -55,8 +55,9 @@ impl HostFunc {
5555
})
5656
}
5757

58-
pub(crate) fn from_closure<T: 'static, F, P, R>(func: F) -> Arc<HostFunc>
58+
pub(crate) fn from_closure<T, F, P, R>(func: F) -> Arc<HostFunc>
5959
where
60+
T: 'static,
6061
F: Fn(StoreContextMut<T>, P) -> Result<R> + Send + Sync + 'static,
6162
P: ComponentNamedList + Lift + 'static,
6263
R: ComponentNamedList + Lower + 'static,
@@ -67,7 +68,7 @@ impl HostFunc {
6768
}
6869

6970
#[cfg(feature = "component-model-async")]
70-
pub(crate) fn from_concurrent<T: 'static, F, P, R>(func: F) -> Arc<HostFunc>
71+
pub(crate) fn from_concurrent<T, F, P, R>(func: F) -> Arc<HostFunc>
7172
where
7273
T: 'static,
7374
F: Fn(&Accessor<T>, P) -> Pin<Box<dyn Future<Output = Result<R>> + Send + '_>>
@@ -86,7 +87,7 @@ impl HostFunc {
8687
})
8788
}
8889

89-
extern "C" fn entrypoint<T: 'static, F, P, R>(
90+
extern "C" fn entrypoint<T, F, P, R>(
9091
cx: NonNull<VMOpaqueContext>,
9192
data: NonNull<u8>,
9293
ty: u32,
@@ -115,7 +116,7 @@ impl HostFunc {
115116
}
116117
}
117118

118-
fn new_dynamic_canonical<T: 'static, F>(func: F) -> Arc<HostFunc>
119+
fn new_dynamic_canonical<T, F>(func: F) -> Arc<HostFunc>
119120
where
120121
F: Fn(
121122
StoreContextMut<'_, T>,
@@ -152,7 +153,7 @@ impl HostFunc {
152153
}
153154

154155
#[cfg(feature = "component-model-async")]
155-
pub(crate) fn new_dynamic_concurrent<T: 'static, F>(func: F) -> Arc<HostFunc>
156+
pub(crate) fn new_dynamic_concurrent<T, F>(func: F) -> Arc<HostFunc>
156157
where
157158
T: 'static,
158159
F: for<'a> Fn(
@@ -922,7 +923,7 @@ pub(crate) fn validate_inbounds_dynamic(
922923
Ok(ptr)
923924
}
924925

925-
extern "C" fn dynamic_entrypoint<T: 'static, F>(
926+
extern "C" fn dynamic_entrypoint<T, F>(
926927
cx: NonNull<VMOpaqueContext>,
927928
data: NonNull<u8>,
928929
ty: u32,

0 commit comments

Comments
 (0)