some minor code simplifications
This commit is contained in:
parent
ecdea9e943
commit
0437a0c372
6 changed files with 8 additions and 15 deletions
|
@ -755,7 +755,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
if let hir::ExprKind::Path(hir::QPath::Resolved(None, path)) = callee_expr.kind
|
if let hir::ExprKind::Path(hir::QPath::Resolved(None, path)) = callee_expr.kind
|
||||||
&& let Res::Local(_) = path.res
|
&& let Res::Local(_) = path.res
|
||||||
&& let [segment] = &path.segments[..]
|
&& let [segment] = &path.segments
|
||||||
{
|
{
|
||||||
for id in self.tcx.hir().items() {
|
for id in self.tcx.hir().items() {
|
||||||
if let Some(node) = self.tcx.hir().get_if_local(id.owner_id.into())
|
if let Some(node) = self.tcx.hir().get_if_local(id.owner_id.into())
|
||||||
|
|
|
@ -401,9 +401,8 @@ pub(super) fn extract_branch_mappings(
|
||||||
}
|
}
|
||||||
let (span, _) = unexpand_into_body_span_with_visible_macro(raw_span, body_span)?;
|
let (span, _) = unexpand_into_body_span_with_visible_macro(raw_span, body_span)?;
|
||||||
|
|
||||||
let bcb_from_marker = |marker: BlockMarkerId| {
|
let bcb_from_marker =
|
||||||
Some(basic_coverage_blocks.bcb_from_bb(block_markers[marker]?)?)
|
|marker: BlockMarkerId| basic_coverage_blocks.bcb_from_bb(block_markers[marker]?);
|
||||||
};
|
|
||||||
|
|
||||||
let true_bcb = bcb_from_marker(true_marker)?;
|
let true_bcb = bcb_from_marker(true_marker)?;
|
||||||
let false_bcb = bcb_from_marker(false_marker)?;
|
let false_bcb = bcb_from_marker(false_marker)?;
|
||||||
|
|
|
@ -144,18 +144,12 @@ pub enum InstrumentCoverage {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Individual flag values controlled by `-Z coverage-options`.
|
/// Individual flag values controlled by `-Z coverage-options`.
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Default)]
|
||||||
pub struct CoverageOptions {
|
pub struct CoverageOptions {
|
||||||
/// Add branch coverage instrumentation.
|
/// Add branch coverage instrumentation.
|
||||||
pub branch: bool,
|
pub branch: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for CoverageOptions {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self { branch: false }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Settings for `-Z instrument-xray` flag.
|
/// Settings for `-Z instrument-xray` flag.
|
||||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||||
pub struct InstrumentXRay {
|
pub struct InstrumentXRay {
|
||||||
|
|
|
@ -1572,7 +1572,7 @@ fn first_non_private<'tcx>(
|
||||||
path: &hir::Path<'tcx>,
|
path: &hir::Path<'tcx>,
|
||||||
) -> Option<Path> {
|
) -> Option<Path> {
|
||||||
let target_def_id = path.res.opt_def_id()?;
|
let target_def_id = path.res.opt_def_id()?;
|
||||||
let (parent_def_id, ident) = match &path.segments[..] {
|
let (parent_def_id, ident) = match &path.segments {
|
||||||
[] => return None,
|
[] => return None,
|
||||||
// Relative paths are available in the same scope as the owner.
|
// Relative paths are available in the same scope as the owner.
|
||||||
[leaf] => (cx.tcx.local_parent(hir_id.owner.def_id), leaf.ident),
|
[leaf] => (cx.tcx.local_parent(hir_id.owner.def_id), leaf.ident),
|
||||||
|
|
|
@ -598,7 +598,7 @@ pub(crate) fn has_doc_flag(tcx: TyCtxt<'_>, did: DefId, flag: Symbol) -> bool {
|
||||||
/// Set by `bootstrap::Builder::doc_rust_lang_org_channel` in order to keep tests passing on beta/stable.
|
/// Set by `bootstrap::Builder::doc_rust_lang_org_channel` in order to keep tests passing on beta/stable.
|
||||||
pub(crate) const DOC_RUST_LANG_ORG_CHANNEL: &str = env!("DOC_RUST_LANG_ORG_CHANNEL");
|
pub(crate) const DOC_RUST_LANG_ORG_CHANNEL: &str = env!("DOC_RUST_LANG_ORG_CHANNEL");
|
||||||
pub(crate) static DOC_CHANNEL: Lazy<&'static str> =
|
pub(crate) static DOC_CHANNEL: Lazy<&'static str> =
|
||||||
Lazy::new(|| DOC_RUST_LANG_ORG_CHANNEL.rsplit('/').filter(|c| !c.is_empty()).next().unwrap());
|
Lazy::new(|| DOC_RUST_LANG_ORG_CHANNEL.rsplit('/').find(|c| !c.is_empty()).unwrap());
|
||||||
|
|
||||||
/// Render a sequence of macro arms in a format suitable for displaying to the user
|
/// Render a sequence of macro arms in a format suitable for displaying to the user
|
||||||
/// as part of an item declaration.
|
/// as part of an item declaration.
|
||||||
|
|
|
@ -150,13 +150,13 @@ impl RenderType {
|
||||||
string.push('{');
|
string.push('{');
|
||||||
write_optional_id(self.id, string);
|
write_optional_id(self.id, string);
|
||||||
string.push('{');
|
string.push('{');
|
||||||
for generic in &self.generics.as_ref().map(Vec::as_slice).unwrap_or_default()[..] {
|
for generic in &self.generics.as_deref().unwrap_or_default()[..] {
|
||||||
generic.write_to_string(string);
|
generic.write_to_string(string);
|
||||||
}
|
}
|
||||||
string.push('}');
|
string.push('}');
|
||||||
if self.bindings.is_some() {
|
if self.bindings.is_some() {
|
||||||
string.push('{');
|
string.push('{');
|
||||||
for binding in &self.bindings.as_ref().map(Vec::as_slice).unwrap_or_default()[..] {
|
for binding in &self.bindings.as_deref().unwrap_or_default()[..] {
|
||||||
string.push('{');
|
string.push('{');
|
||||||
binding.0.write_to_string(string);
|
binding.0.write_to_string(string);
|
||||||
string.push('{');
|
string.push('{');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue