Skip to content

Commit c6637f3

Browse files
clippy: Enable borrowed_box rule
1 parent d45cabd commit c6637f3

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ new_ret_no_self = "allow"
168168
useless_asref = "allow"
169169

170170
## Following lints should be tackled at some point
171-
borrowed_box = "allow"
172171
too_many_arguments = "allow"
173172
type_complexity = "allow"
174173
wrong_self_convention = "allow"

crates/hir-def/src/generics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ impl GenericParamsCollector {
264264
self.add_where_predicate_from_bound(
265265
lower_ctx,
266266
bound,
267-
lifetimes.as_ref(),
267+
lifetimes.as_deref(),
268268
target.clone(),
269269
);
270270
}
@@ -275,14 +275,14 @@ impl GenericParamsCollector {
275275
&mut self,
276276
lower_ctx: &LowerCtx<'_>,
277277
bound: ast::TypeBound,
278-
hrtb_lifetimes: Option<&Box<[Name]>>,
278+
hrtb_lifetimes: Option<&[Name]>,
279279
target: Either<TypeRef, LifetimeRef>,
280280
) {
281281
let bound = TypeBound::from_ast(lower_ctx, bound);
282282
let predicate = match (target, bound) {
283283
(Either::Left(type_ref), bound) => match hrtb_lifetimes {
284284
Some(hrtb_lifetimes) => WherePredicate::ForLifetime {
285-
lifetimes: hrtb_lifetimes.clone(),
285+
lifetimes: hrtb_lifetimes.to_vec().into_boxed_slice(),
286286
target: WherePredicateTypeTarget::TypeRef(Interned::new(type_ref)),
287287
bound: Interned::new(bound),
288288
},

crates/hir-ty/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ impl MemoryMap {
228228
&self,
229229
mut f: impl FnMut(&[u8], usize) -> Result<usize, MirEvalError>,
230230
) -> Result<FxHashMap<usize, usize>, MirEvalError> {
231-
let mut transform = |(addr, val): (&usize, &Box<[u8]>)| {
231+
let mut transform = |(addr, val): (&usize, &[u8])| {
232232
let addr = *addr;
233233
let align = if addr == 0 { 64 } else { (addr - (addr & (addr - 1))).min(64) };
234234
f(val, align).map(|it| (addr, it))
@@ -240,7 +240,9 @@ impl MemoryMap {
240240
map.insert(addr, val);
241241
map
242242
}),
243-
MemoryMap::Complex(cm) => cm.memory.iter().map(transform).collect(),
243+
MemoryMap::Complex(cm) => {
244+
cm.memory.iter().map(|(addr, val)| transform((addr, val))).collect()
245+
}
244246
}
245247
}
246248

0 commit comments

Comments
 (0)