Rollup merge of #89943 - matthiaskrgr:clpcompl, r=oli-obk

clippy::complexity fixes
This commit is contained in:
Yuki Okushi 2021-10-17 07:52:20 +09:00 committed by GitHub
commit b8173c59c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 11 deletions

View file

@ -171,7 +171,7 @@ fn get_features(
} }
if let Some(allowed) = sess.opts.debugging_opts.allow_features.as_ref() { if let Some(allowed) = sess.opts.debugging_opts.allow_features.as_ref() {
if allowed.iter().find(|&f| name.as_str() == *f).is_none() { if allowed.iter().all(|f| name.as_str() != *f) {
struct_span_err!( struct_span_err!(
span_handler, span_handler,
mi.span(), mi.span(),

View file

@ -1004,13 +1004,13 @@ impl<Tag: Copy, Extra> Allocation<Tag, Extra> {
/// Checks that a range of bytes is initialized. If not, returns the `InvalidUninitBytes` /// Checks that a range of bytes is initialized. If not, returns the `InvalidUninitBytes`
/// error which will report the first range of bytes which is uninitialized. /// error which will report the first range of bytes which is uninitialized.
fn check_init(&self, range: AllocRange) -> AllocResult { fn check_init(&self, range: AllocRange) -> AllocResult {
self.is_init(range).or_else(|idx_range| { self.is_init(range).map_err(|idx_range| {
Err(AllocError::InvalidUninitBytes(Some(UninitBytesAccess { AllocError::InvalidUninitBytes(Some(UninitBytesAccess {
access_offset: range.start, access_offset: range.start,
access_size: range.size, access_size: range.size,
uninit_offset: idx_range.start, uninit_offset: idx_range.start,
uninit_size: idx_range.end - idx_range.start, // `Size` subtraction uninit_size: idx_range.end - idx_range.start, // `Size` subtraction
}))) }))
}) })
} }

View file

@ -1837,7 +1837,7 @@ crate fn show_candidates(
.skip(1) .skip(1)
.all(|(_, descr, _)| descr == descr_first) .all(|(_, descr, _)| descr == descr_first)
{ {
format!("{}", descr_first) descr_first.to_string()
} else { } else {
"item".to_string() "item".to_string()
}; };

View file

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

View file

@ -113,11 +113,9 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
.unwrap_or(&[]) .unwrap_or(&[])
.iter() .iter()
.filter_map(|attr| { .filter_map(|attr| {
Some( Cfg::parse(attr.meta_item()?)
Cfg::parse(attr.meta_item()?) .map_err(|e| self.cx.sess().diagnostic().span_err(e.span, e.msg))
.map_err(|e| self.cx.sess().diagnostic().span_err(e.span, e.msg)) .ok()
.ok()?,
)
}) })
.collect::<Vec<_>>() .collect::<Vec<_>>()
}) })