mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
use vec![] macro to create Vector with first item inside instead of pushing to an empty vec![]
slightly reduces code bloat
This commit is contained in:
parent
71a6c7c803
commit
1c129f7b97
@ -2189,8 +2189,7 @@ impl<'a> State<'a> {
|
|||||||
Options(InlineAsmOptions),
|
Options(InlineAsmOptions),
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut args = vec![];
|
let mut args = vec![AsmArg::Template(InlineAsmTemplatePiece::to_string(&asm.template))];
|
||||||
args.push(AsmArg::Template(InlineAsmTemplatePiece::to_string(&asm.template)));
|
|
||||||
args.extend(asm.operands.iter().map(|(o, _)| AsmArg::Operand(o)));
|
args.extend(asm.operands.iter().map(|(o, _)| AsmArg::Operand(o)));
|
||||||
if !asm.options.is_empty() {
|
if !asm.options.is_empty() {
|
||||||
args.push(AsmArg::Options(asm.options));
|
args.push(AsmArg::Options(asm.options));
|
||||||
|
@ -1356,8 +1356,8 @@ impl<'a> State<'a> {
|
|||||||
Options(ast::InlineAsmOptions),
|
Options(ast::InlineAsmOptions),
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut args = vec![];
|
let mut args =
|
||||||
args.push(AsmArg::Template(ast::InlineAsmTemplatePiece::to_string(&asm.template)));
|
vec![AsmArg::Template(ast::InlineAsmTemplatePiece::to_string(&asm.template))];
|
||||||
args.extend(asm.operands.iter().map(|(o, _)| AsmArg::Operand(o)));
|
args.extend(asm.operands.iter().map(|(o, _)| AsmArg::Operand(o)));
|
||||||
if !asm.options.is_empty() {
|
if !asm.options.is_empty() {
|
||||||
args.push(AsmArg::Options(asm.options));
|
args.push(AsmArg::Options(asm.options));
|
||||||
|
@ -526,8 +526,8 @@ impl TraverseCoverageGraphWithLoops {
|
|||||||
pub fn new(basic_coverage_blocks: &CoverageGraph) -> Self {
|
pub fn new(basic_coverage_blocks: &CoverageGraph) -> Self {
|
||||||
let start_bcb = basic_coverage_blocks.start_node();
|
let start_bcb = basic_coverage_blocks.start_node();
|
||||||
let backedges = find_loop_backedges(basic_coverage_blocks);
|
let backedges = find_loop_backedges(basic_coverage_blocks);
|
||||||
let mut context_stack = Vec::new();
|
let context_stack =
|
||||||
context_stack.push(TraversalContext { loop_backedges: None, worklist: vec![start_bcb] });
|
vec![TraversalContext { loop_backedges: None, worklist: vec![start_bcb] }];
|
||||||
// `context_stack` starts with a `TraversalContext` for the main function context (beginning
|
// `context_stack` starts with a `TraversalContext` for the main function context (beginning
|
||||||
// with the `start` BasicCoverageBlock of the function). New worklists are pushed to the top
|
// with the `start` BasicCoverageBlock of the function). New worklists are pushed to the top
|
||||||
// of the stack as loops are entered, and popped off of the stack when a loop's worklist is
|
// of the stack as loops are entered, and popped off of the stack when a loop's worklist is
|
||||||
|
@ -124,11 +124,10 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||||||
self.impl_similar_to(trait_ref, obligation).unwrap_or_else(|| trait_ref.def_id());
|
self.impl_similar_to(trait_ref, obligation).unwrap_or_else(|| trait_ref.def_id());
|
||||||
let trait_ref = trait_ref.skip_binder();
|
let trait_ref = trait_ref.skip_binder();
|
||||||
|
|
||||||
let mut flags = vec![];
|
let mut flags = vec![(
|
||||||
flags.push((
|
|
||||||
sym::ItemContext,
|
sym::ItemContext,
|
||||||
self.describe_enclosure(obligation.cause.body_id).map(|s| s.to_owned()),
|
self.describe_enclosure(obligation.cause.body_id).map(|s| s.to_owned()),
|
||||||
));
|
)];
|
||||||
|
|
||||||
match obligation.cause.code {
|
match obligation.cause.code {
|
||||||
ObligationCauseCode::BuiltinDerivedObligation(..)
|
ObligationCauseCode::BuiltinDerivedObligation(..)
|
||||||
|
Loading…
Reference in New Issue
Block a user