Skip to content

Commit b8173c5

Browse files
authored
Rollup merge of #89943 - matthiaskrgr:clpcompl, r=oli-obk
clippy::complexity fixes
2 parents c393f33 + c645d3f commit b8173c5

File tree

5 files changed

+9
-11
lines changed

5 files changed

+9
-11
lines changed

compiler/rustc_expand/src/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ fn get_features(
171171
}
172172

173173
if let Some(allowed) = sess.opts.debugging_opts.allow_features.as_ref() {
174-
if allowed.iter().find(|&f| name.as_str() == *f).is_none() {
174+
if allowed.iter().all(|f| name.as_str() != *f) {
175175
struct_span_err!(
176176
span_handler,
177177
mi.span(),

compiler/rustc_middle/src/mir/interpret/allocation.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1004,13 +1004,13 @@ impl<Tag: Copy, Extra> Allocation<Tag, Extra> {
10041004
/// Checks that a range of bytes is initialized. If not, returns the `InvalidUninitBytes`
10051005
/// error which will report the first range of bytes which is uninitialized.
10061006
fn check_init(&self, range: AllocRange) -> AllocResult {
1007-
self.is_init(range).or_else(|idx_range| {
1008-
Err(AllocError::InvalidUninitBytes(Some(UninitBytesAccess {
1007+
self.is_init(range).map_err(|idx_range| {
1008+
AllocError::InvalidUninitBytes(Some(UninitBytesAccess {
10091009
access_offset: range.start,
10101010
access_size: range.size,
10111011
uninit_offset: idx_range.start,
10121012
uninit_size: idx_range.end - idx_range.start, // `Size` subtraction
1013-
})))
1013+
}))
10141014
})
10151015
}
10161016

compiler/rustc_resolve/src/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1837,7 +1837,7 @@ crate fn show_candidates(
18371837
.skip(1)
18381838
.all(|(_, descr, _)| descr == descr_first)
18391839
{
1840-
format!("{}", descr_first)
1840+
descr_first.to_string()
18411841
} else {
18421842
"item".to_string()
18431843
};

src/librustdoc/html/markdown.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ crate fn find_testable_code<T: doctest::Tester>(
765765
// If there are characters between the preceding line ending and
766766
// this code block, `str::lines` will return an additional line,
767767
// which we subtract here.
768-
if nb_lines != 0 && !&doc[prev_offset..offset.start].ends_with("\n") {
768+
if nb_lines != 0 && !&doc[prev_offset..offset.start].ends_with('\n') {
769769
nb_lines -= 1;
770770
}
771771
let line = tests.get_line() + nb_lines + 1;

src/librustdoc/visit_ast.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,9 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
113113
.unwrap_or(&[])
114114
.iter()
115115
.filter_map(|attr| {
116-
Some(
117-
Cfg::parse(attr.meta_item()?)
118-
.map_err(|e| self.cx.sess().diagnostic().span_err(e.span, e.msg))
119-
.ok()?,
120-
)
116+
Cfg::parse(attr.meta_item()?)
117+
.map_err(|e| self.cx.sess().diagnostic().span_err(e.span, e.msg))
118+
.ok()
121119
})
122120
.collect::<Vec<_>>()
123121
})

0 commit comments

Comments
 (0)