Skip to content

Commit c57704f

Browse files
committed
Auto merge of #90695 - GuillaumeGomez:rollup-kxvvw4o, r=GuillaumeGomez
Rollup of 4 pull requests Successful merges: - #90494 (ARMv6K Horizon OS panic change) - #90652 (use filter(|x| matches!(..)) instead of filter_map(|x| match x ... => Some(xy))) - #90657 (Fix bug with `#[doc]` string single-character last lines) - #90689 (:arrow_up: rust-analyzer) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 5154727 + 2709524 commit c57704f

File tree

8 files changed

+25
-29
lines changed

8 files changed

+25
-29
lines changed

compiler/rustc_ast/src/util/comments.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub fn beautify_doc_string(data: Symbol) -> Symbol {
3838
i += 1;
3939
}
4040
// like the first, a last line of all stars should be omitted
41-
if j > i && lines[j - 1].chars().skip(1).all(|c| c == '*') {
41+
if j > i && !lines[j - 1].is_empty() && lines[j - 1].chars().all(|c| c == '*') {
4242
j -= 1;
4343
}
4444

compiler/rustc_resolve/src/late/lifetimes.rs

+8-20
Original file line numberDiff line numberDiff line change
@@ -887,10 +887,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
887887
let (lifetimes, binders): (FxIndexMap<hir::ParamName, Region>, Vec<_>) = c
888888
.generic_params
889889
.iter()
890-
.filter_map(|param| match param.kind {
891-
GenericParamKind::Lifetime { .. } => Some(param),
892-
_ => None,
893-
})
890+
.filter(|param| matches!(param.kind, GenericParamKind::Lifetime { .. }))
894891
.enumerate()
895892
.map(|(late_bound_idx, param)| {
896893
let pair = Region::late(late_bound_idx as u32, &self.tcx.hir(), param);
@@ -1370,9 +1367,8 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
13701367
let (lifetimes, binders): (FxIndexMap<hir::ParamName, Region>, Vec<_>) =
13711368
bound_generic_params
13721369
.iter()
1373-
.filter_map(|param| match param.kind {
1374-
GenericParamKind::Lifetime { .. } => Some(param),
1375-
_ => None,
1370+
.filter(|param| {
1371+
matches!(param.kind, GenericParamKind::Lifetime { .. })
13761372
})
13771373
.enumerate()
13781374
.map(|(late_bound_idx, param)| {
@@ -1469,10 +1465,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
14691465
let binders_iter = trait_ref
14701466
.bound_generic_params
14711467
.iter()
1472-
.filter_map(|param| match param.kind {
1473-
GenericParamKind::Lifetime { .. } => Some(param),
1474-
_ => None,
1475-
})
1468+
.filter(|param| matches!(param.kind, GenericParamKind::Lifetime { .. }))
14761469
.enumerate()
14771470
.map(|(late_bound_idx, param)| {
14781471
let pair = Region::late(
@@ -2235,19 +2228,14 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
22352228
let binders: Vec<_> = generics
22362229
.params
22372230
.iter()
2238-
.filter_map(|param| match param.kind {
2239-
GenericParamKind::Lifetime { .. }
2240-
if self.map.late_bound.contains(&param.hir_id) =>
2241-
{
2242-
Some(param)
2243-
}
2244-
_ => None,
2231+
.filter(|param| {
2232+
matches!(param.kind, GenericParamKind::Lifetime { .. })
2233+
&& self.map.late_bound.contains(&param.hir_id)
22452234
})
22462235
.enumerate()
22472236
.map(|(late_bound_idx, param)| {
22482237
let pair = Region::late(late_bound_idx as u32, &self.tcx.hir(), param);
2249-
let r = late_region_as_bound_region(self.tcx, &pair.1);
2250-
r
2238+
late_region_as_bound_region(self.tcx, &pair.1)
22512239
})
22522240
.collect();
22532241
self.map.late_bound_vars.insert(hir_id, binders);

compiler/rustc_target/src/spec/armv6k_nintendo_3ds.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{LinkArgs, LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions};
1+
use crate::spec::{LinkArgs, LinkerFlavor, RelocModel, Target, TargetOptions};
22

33
/// A base target for Nintendo 3DS devices using the devkitARM toolchain.
44
///
@@ -36,7 +36,6 @@ pub fn target() -> Target {
3636
features: "+vfp2".to_string(),
3737
pre_link_args,
3838
exe_suffix: ".elf".to_string(),
39-
panic_strategy: PanicStrategy::Abort,
4039
..Default::default()
4140
},
4241
}

compiler/rustc_typeck/src/coherence/builtin.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,14 @@ fn visit_implementation_of_dispatch_from_dyn(tcx: TyCtxt<'_>, impl_did: LocalDef
180180

181181
let coerced_fields = fields
182182
.iter()
183-
.filter_map(|field| {
183+
.filter(|field| {
184184
let ty_a = field.ty(tcx, substs_a);
185185
let ty_b = field.ty(tcx, substs_b);
186186

187187
if let Ok(layout) = tcx.layout_of(param_env.and(ty_a)) {
188188
if layout.is_zst() && layout.align.abi.bytes() == 1 {
189189
// ignore ZST fields with alignment of 1 byte
190-
return None;
190+
return false;
191191
}
192192
}
193193

@@ -204,11 +204,11 @@ fn visit_implementation_of_dispatch_from_dyn(tcx: TyCtxt<'_>, impl_did: LocalDef
204204
))
205205
.emit();
206206

207-
return None;
207+
return false;
208208
}
209209
}
210210

211-
Some(field)
211+
return true;
212212
})
213213
.collect::<Vec<_>>();
214214

src/test/rustdoc/include_str_cut.rs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![crate_name = "foo"]
2+
#![no_std]
3+
4+
// @has 'foo/fn.foo.html'
5+
// @has - '//*[@class="docblock"]' 'inc2 x'
6+
#[doc = include_str!("short-line.md")]
7+
pub fn foo() {}

src/test/rustdoc/short-line.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
inc2
2+
x

src/tools/rust-analyzer

0 commit comments

Comments
 (0)