mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 18:23:49 +00:00
use question mark operator in a few places.
This commit is contained in:
parent
9381e8178b
commit
ecae6e4260
@ -1894,9 +1894,7 @@ where
|
|||||||
let to_skip = self.n;
|
let to_skip = self.n;
|
||||||
self.n = 0;
|
self.n = 0;
|
||||||
// nth(n) skips n+1
|
// nth(n) skips n+1
|
||||||
if self.iter.nth(to_skip - 1).is_none() {
|
self.iter.nth(to_skip - 1)?;
|
||||||
return None;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
self.iter.nth(n)
|
self.iter.nth(n)
|
||||||
}
|
}
|
||||||
@ -1916,9 +1914,7 @@ where
|
|||||||
fn last(mut self) -> Option<I::Item> {
|
fn last(mut self) -> Option<I::Item> {
|
||||||
if self.n > 0 {
|
if self.n > 0 {
|
||||||
// nth(n) skips n+1
|
// nth(n) skips n+1
|
||||||
if self.iter.nth(self.n - 1).is_none() {
|
self.iter.nth(self.n - 1)?;
|
||||||
return None;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
self.iter.last()
|
self.iter.last()
|
||||||
}
|
}
|
||||||
|
@ -338,9 +338,8 @@ impl<'hir> Map<'hir> {
|
|||||||
Node::Variant(_) => DefKind::Variant,
|
Node::Variant(_) => DefKind::Variant,
|
||||||
Node::Ctor(variant_data) => {
|
Node::Ctor(variant_data) => {
|
||||||
// FIXME(eddyb) is this even possible, if we have a `Node::Ctor`?
|
// FIXME(eddyb) is this even possible, if we have a `Node::Ctor`?
|
||||||
if variant_data.ctor_hir_id().is_none() {
|
variant_data.ctor_hir_id()?;
|
||||||
return None;
|
|
||||||
}
|
|
||||||
let ctor_of = match self.find(self.get_parent_node(hir_id)) {
|
let ctor_of = match self.find(self.get_parent_node(hir_id)) {
|
||||||
Some(Node::Item(..)) => def::CtorOf::Struct,
|
Some(Node::Item(..)) => def::CtorOf::Struct,
|
||||||
Some(Node::Variant(..)) => def::CtorOf::Variant,
|
Some(Node::Variant(..)) => def::CtorOf::Variant,
|
||||||
|
@ -115,9 +115,7 @@ impl<'tcx> Instance<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If this a non-generic instance, it cannot be a shared monomorphization.
|
// If this a non-generic instance, it cannot be a shared monomorphization.
|
||||||
if self.substs.non_erasable_generics().next().is_none() {
|
self.substs.non_erasable_generics().next()?;
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
match self.def {
|
match self.def {
|
||||||
InstanceDef::Item(def_id) => tcx
|
InstanceDef::Item(def_id) => tcx
|
||||||
|
@ -13,9 +13,7 @@ pub fn copy_cgu_workproducts_to_incr_comp_cache_dir(
|
|||||||
files: &[(WorkProductFileKind, PathBuf)],
|
files: &[(WorkProductFileKind, PathBuf)],
|
||||||
) -> Option<(WorkProductId, WorkProduct)> {
|
) -> Option<(WorkProductId, WorkProduct)> {
|
||||||
debug!("copy_cgu_workproducts_to_incr_comp_cache_dir({:?},{:?})", cgu_name, files);
|
debug!("copy_cgu_workproducts_to_incr_comp_cache_dir({:?},{:?})", cgu_name, files);
|
||||||
if sess.opts.incremental.is_none() {
|
sess.opts.incremental.as_ref()?;
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
let saved_files = files
|
let saved_files = files
|
||||||
.iter()
|
.iter()
|
||||||
|
Loading…
Reference in New Issue
Block a user