Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #104236

Merged
merged 76 commits into from
Nov 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
0f46f27
Migrate most of `ide_assists::utils` to format arg capture
DropDemBits Oct 10, 2022
d439fb2
Migrate assists to format args captures, part 1
DropDemBits Oct 10, 2022
b1909a8
Migrate assists to format args captures, part 3
DropDemBits Oct 10, 2022
8ebc96a
fix broken links in guide.md
notJoon Oct 20, 2022
e4ef0e5
addressed https://github.com/rust-lang/rust-analyzer/issues/12536
justinmmott Oct 21, 2022
8039a07
ide: Generate monikers for local crates.
emilio Oct 22, 2022
c4bdb8e
feat: add config for inserting must_use in `generate_enum_as_method`
feniljain Oct 6, 2022
4bf9b9b
refactor: remove repetitive string interpolation and doc changes
feniljain Oct 24, 2022
4a7f5ca
fix: async trait method for `unnecessary_async`
koka831 Oct 28, 2022
cf90e4f
Simplify the procedure
koka831 Oct 29, 2022
319611b
Record diverging match arms in `InferenceResult`
unexge Oct 29, 2022
48efc9d
Add `Convert match to let-else` assist
unexge Oct 29, 2022
f0a1434
Update auto generated tests
unexge Oct 29, 2022
98125b9
fix: make custom expr prefix completions to understand refs
feniljain Oct 30, 2022
8142d1f
Auto merge of #13445 - notJoon:modify-dead-links, r=lnicola
bors Oct 31, 2022
db8c752
fix: disregard type variable expectation for if expressions
lowr Oct 31, 2022
07f6efc
Auto merge of #13523 - lowr:fix/adjust-expectation-for-if, r=lnicola
bors Oct 31, 2022
ecad1a9
Create `Callable`s for generic types implementing `FnOnce`
Nov 1, 2022
9f1bb17
Import `option` in the tests
Nov 1, 2022
e110c78
Revert "Record diverging match arms in `InferenceResult`"
Nov 1, 2022
72d5b45
Fix doc test
Nov 1, 2022
d90cb1e
Auto merge of #13516 - unexge:add-convert-match-to-let-else-assist, r…
bors Nov 1, 2022
a8e97bc
Auto merge of #13508 - koka831:fix/13492, r=jonas-schievink
bors Nov 1, 2022
c1305fa
Auto merge of #13525 - jonas-schievink:generic-call-signature, r=jona…
bors Nov 1, 2022
62a6cdf
Use let-else statements in `Convert to guarded return` assist
unexge Nov 1, 2022
12ced8f
Auto merge of #13517 - feniljain:fix_completions, r=Veykril
bors Nov 2, 2022
691ce30
fix: indentation after inserting `#must_use`
feniljain Nov 2, 2022
af1f48d
Auto merge of #13359 - feniljain:feat-must-use-option, r=Veykril
bors Nov 2, 2022
6c3ab56
Auto merge of #13527 - unexge:use-let-else-stmt-in-convert-to-guarded…
bors Nov 2, 2022
adee109
Bump ovsx
lnicola Nov 2, 2022
56c97a8
Auto merge of #13530 - lnicola:bump-ovsx, r=lnicola
bors Nov 2, 2022
08c2b45
docs: add crates section to the manual
pd4d10 Nov 3, 2022
6073e58
Allow ovsx publishing to fail
lnicola Nov 3, 2022
f3a6871
Auto merge of #13537 - lnicola:ovsx-fail, r=lnicola
bors Nov 3, 2022
bbcb77e
Auto merge of #13456 - emilio:scip-local-symbol, r=Veykril
bors Nov 3, 2022
6750f6b
Clarify what commands are debug commands in VSCode
Veykril Nov 3, 2022
3508820
Add rustbot features related to PR state labels
HKalbasi Nov 4, 2022
ad633db
Auto merge of #13544 - HKalbasi:patch-2, r=Veykril
bors Nov 4, 2022
6f09c72
Lower unsafety of fn pointer and fn item types
Veykril Nov 4, 2022
cd26032
Auto merge of #13546 - Veykril:unsafe-fn-ptr, r=Veykril
bors Nov 4, 2022
26b5621
Mark the Memory Usage command as debug command
Veykril Nov 4, 2022
66900a7
Auto merge of #13541 - Veykril:dbg-cmd, r=Veykril
bors Nov 4, 2022
df38770
Auto merge of #13454 - justinmmott:master, r=flodiebold
bors Nov 5, 2022
17619de
fix: Fix reference searching only accounting substrings instead of wh…
Veykril Nov 5, 2022
2c37e7d
Auto merge of #13549 - Veykril:search-fix, r=Veykril
bors Nov 5, 2022
afe8f6b
Auto merge of #13379 - DropDemBits:ide-assists-format-args-capture, r…
bors Nov 5, 2022
ef46168
minor: Update github issue templates
Veykril Nov 5, 2022
25b1d6f
Auto merge of #13435 - DropDemBits:assists-format-args-capture-pt3, r…
bors Nov 5, 2022
c06bbfb
Auto merge of #13536 - pd4d10:patch-1, r=Veykril
bors Nov 5, 2022
e47460b
Auto merge of #13550 - Veykril:issue-template, r=lnicola
bors Nov 5, 2022
935eb3f
docs: fix adoc links
pd4d10 Nov 5, 2022
d03c1c8
Auto merge of #13556 - pd4d10:patch-1, r=lnicola
bors Nov 5, 2022
c199a39
bootstrap: add support for running Miri on a file
RalfJung Nov 6, 2022
a9edee7
bootstrap: put Miri sysroot into local build dir
RalfJung Nov 6, 2022
aa5a326
Parser: Recover from using colon as path separator in imports
mucinoab Nov 9, 2022
35ef05a
Ignore "Change InferCtxtBuilder from enter to build" in git blame
Noratrieb Nov 9, 2022
8f9bc6d
Migrate crate-search element to CSS variables
GuillaumeGomez Nov 7, 2022
0e804b4
Extend crate-search div GUI tests
GuillaumeGomez Nov 7, 2022
dc76687
Update browser-ui-test version to 0.13.1
GuillaumeGomez Nov 8, 2022
75b5a98
Add new option to prevent CORS failures
GuillaumeGomez Nov 8, 2022
9f0e376
Update to new browser-ui-test version
GuillaumeGomez Nov 9, 2022
fbce7de
DiagnosticBuilder -> Diagnostic
compiler-errors Oct 6, 2022
e807cb3
Make span_suggestions take IntoIterator
compiler-errors Oct 7, 2022
9568138
rebase conflict
compiler-errors Nov 5, 2022
ff118a8
:arrow_up: rust-analyzer
lnicola Nov 9, 2022
0b6934d
remove redundent "<>" for ty::Slice with reference type
Oct 28, 2022
d924dde
update mailmap
ibraheemdev Nov 10, 2022
e5ecf62
Rollup merge of #102763 - compiler-errors:nits, r=cjgillot
compiler-errors Nov 10, 2022
0c4a81c
Rollup merge of #103443 - mucinoab:recover-colon-as-path-separetor, r…
compiler-errors Nov 10, 2022
f916022
Rollup merge of #103675 - lyming2007:issue-103271-fix, r=fee1-dead
compiler-errors Nov 10, 2022
7124590
Rollup merge of #104046 - RalfJung:run-miri-run, r=oli-obk
compiler-errors Nov 10, 2022
5499687
Rollup merge of #104115 - GuillaumeGomez:migrate-crate-search-div, r=…
compiler-errors Nov 10, 2022
41c8a62
Rollup merge of #104190 - Nilstrieb:patch-1, r=compiler-errors
compiler-errors Nov 10, 2022
985fa02
Rollup merge of #104201 - GuillaumeGomez:gui-test-check-file-errors, …
compiler-errors Nov 10, 2022
1b1fcf0
Rollup merge of #104211 - lnicola:rust-analyzer-2022-11-09, r=lnicola
compiler-errors Nov 10, 2022
609bea9
Rollup merge of #104231 - ibraheemdev:patch-12, r=compiler-errors
compiler-errors Nov 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ a06baa56b95674fc626b3c3fd680d6a65357fe60
95e00bfed801e264e9c4ac817004153ca0f19eb6
# reformat with new rustfmt
971c549ca334b7b7406e61e958efcca9c4152822
# refactor infcx building
283abbf0e7d20176f76006825b5c52e9a4234e4c
2 changes: 1 addition & 1 deletion .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ Hsiang-Cheng Yang <rick68@users.noreply.github.com>
Ian Jackson <ijackson@chiark.greenend.org.uk> <ian.jackson@citrix.com>
Ian Jackson <ijackson@chiark.greenend.org.uk> <ijackson+github@slimy.greenend.org.uk>
Ian Jackson <ijackson@chiark.greenend.org.uk> <iwj@xenproject.org>
Ibraheem Ahmed <ibrah1440@gmail.com>
Ibraheem Ahmed <ibraheem@ibraheem.ca> <ibrah1440@gmail.com>
Ilyong Cho <ilyoan@gmail.com>
inquisitivecrystal <22333129+inquisitivecrystal@users.noreply.github.com>
Irina Popa <irinagpopa@gmail.com>
Expand Down
21 changes: 7 additions & 14 deletions compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use rustc_errors::{
Applicability, Diagnostic, DiagnosticBuilder, EmissionGuarantee, ErrorGuaranteed,
};
use rustc_errors::{Applicability, Diagnostic};
use rustc_hir as hir;
use rustc_hir::intravisit::Visitor;
use rustc_hir::Node;
Expand Down Expand Up @@ -629,25 +627,20 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
self.buffer_error(err);
}

fn suggest_map_index_mut_alternatives(
&self,
ty: Ty<'_>,
err: &mut DiagnosticBuilder<'_, ErrorGuaranteed>,
span: Span,
) {
fn suggest_map_index_mut_alternatives(&self, ty: Ty<'tcx>, err: &mut Diagnostic, span: Span) {
let Some(adt) = ty.ty_adt_def() else { return };
let did = adt.did();
if self.infcx.tcx.is_diagnostic_item(sym::HashMap, did)
|| self.infcx.tcx.is_diagnostic_item(sym::BTreeMap, did)
{
struct V<'a, 'b, 'tcx, G: EmissionGuarantee> {
struct V<'a, 'tcx> {
assign_span: Span,
err: &'a mut DiagnosticBuilder<'b, G>,
err: &'a mut Diagnostic,
ty: Ty<'tcx>,
suggested: bool,
}
impl<'a, 'b: 'a, 'hir, 'tcx, G: EmissionGuarantee> Visitor<'hir> for V<'a, 'b, 'tcx, G> {
fn visit_stmt(&mut self, stmt: &'hir hir::Stmt<'hir>) {
impl<'a, 'tcx> Visitor<'tcx> for V<'a, 'tcx> {
fn visit_stmt(&mut self, stmt: &'tcx hir::Stmt<'tcx>) {
hir::intravisit::walk_stmt(self, stmt);
let expr = match stmt.kind {
hir::StmtKind::Semi(expr) | hir::StmtKind::Expr(expr) => expr,
Expand Down Expand Up @@ -705,7 +698,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
),
(rv.span.shrink_to_hi(), ")".to_string()),
],
].into_iter(),
],
Applicability::MachineApplicable,
);
self.suggested = true;
Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_errors/src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ impl Diagnostic {
&mut self,
sp: Span,
msg: impl Into<SubdiagnosticMessage>,
suggestions: impl Iterator<Item = String>,
suggestions: impl IntoIterator<Item = String>,
applicability: Applicability,
) -> &mut Self {
self.span_suggestions_with_style(
Expand All @@ -759,11 +759,11 @@ impl Diagnostic {
&mut self,
sp: Span,
msg: impl Into<SubdiagnosticMessage>,
suggestions: impl Iterator<Item = String>,
suggestions: impl IntoIterator<Item = String>,
applicability: Applicability,
style: SuggestionStyle,
) -> &mut Self {
let mut suggestions: Vec<_> = suggestions.collect();
let mut suggestions: Vec<_> = suggestions.into_iter().collect();
suggestions.sort();

debug_assert!(
Expand All @@ -790,10 +790,10 @@ impl Diagnostic {
pub fn multipart_suggestions(
&mut self,
msg: impl Into<SubdiagnosticMessage>,
suggestions: impl Iterator<Item = Vec<(Span, String)>>,
suggestions: impl IntoIterator<Item = Vec<(Span, String)>>,
applicability: Applicability,
) -> &mut Self {
let suggestions: Vec<_> = suggestions.collect();
let suggestions: Vec<_> = suggestions.into_iter().collect();
debug_assert!(
!(suggestions
.iter()
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_errors/src/diagnostic_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,13 +599,13 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
&mut self,
sp: Span,
msg: impl Into<SubdiagnosticMessage>,
suggestions: impl Iterator<Item = String>,
suggestions: impl IntoIterator<Item = String>,
applicability: Applicability,
) -> &mut Self);
forward!(pub fn multipart_suggestions(
&mut self,
msg: impl Into<SubdiagnosticMessage>,
suggestions: impl Iterator<Item = Vec<(Span, String)>>,
suggestions: impl IntoIterator<Item = Vec<(Span, String)>>,
applicability: Applicability,
) -> &mut Self);
forward!(pub fn span_suggestion_short(
Expand Down
6 changes: 6 additions & 0 deletions compiler/rustc_hir_typeck/src/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1900,6 +1900,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
| ty::Str
| ty::Projection(_)
| ty::Param(_) => format!("{deref_ty}"),
// we need to test something like <&[_]>::len
// and Vec::function();
// <&[_]>::len doesn't need an extra "<>" between
// but for Adt type like Vec::function()
// we would suggest <[_]>::function();
_ if self.tcx.sess.source_map().span_wrapped_by_angle_bracket(ty.span) => format!("{deref_ty}"),
_ => format!("<{deref_ty}>"),
};
err.span_suggestion_verbose(
Expand Down
17 changes: 17 additions & 0 deletions compiler/rustc_parse/src/parser/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,23 @@ impl<'a> Parser<'a> {
if self.eat(&token::ModSep) {
self.parse_use_tree_glob_or_nested()?
} else {
// Recover from using a colon as path separator.
while self.eat_noexpect(&token::Colon) {
self.struct_span_err(self.prev_token.span, "expected `::`, found `:`")
.span_suggestion_short(
self.prev_token.span,
"use double colon",
"::",
Applicability::MachineApplicable,
)
.note_once("import paths are delimited using `::`")
.emit();

// We parse the rest of the path and append it to the original prefix.
self.parse_path_segments(&mut prefix.segments, PathStyle::Mod, None)?;
prefix.span = lo.to(self.prev_token.span);
}

UseTreeKind::Simple(self.parse_rename()?, DUMMY_NODE_ID, DUMMY_NODE_ID)
}
};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_parse/src/parser/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ impl<'a> Parser<'a> {
.span_suggestions(
span.shrink_to_hi(),
"add `mut` or `const` here",
["mut ".to_string(), "const ".to_string()].into_iter(),
["mut ".to_string(), "const ".to_string()],
Applicability::HasPlaceholders,
)
.emit();
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_passes/src/liveness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ use self::VarKind::*;
use rustc_ast::InlineAsmOptions;
use rustc_data_structures::fx::FxIndexMap;
use rustc_errors::Applicability;
use rustc_errors::Diagnostic;
use rustc_hir as hir;
use rustc_hir::def::*;
use rustc_hir::def_id::{DefId, LocalDefId};
Expand Down Expand Up @@ -1690,7 +1691,7 @@ impl<'tcx> Liveness<'_, 'tcx> {
&self,
name: &str,
opt_body: Option<&hir::Body<'_>>,
err: &mut rustc_errors::DiagnosticBuilder<'_, ()>,
err: &mut Diagnostic,
) -> bool {
let mut has_litstring = false;
let Some(opt_body) = opt_body else {return false;};
Expand Down
16 changes: 8 additions & 8 deletions compiler/rustc_resolve/src/late/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {

fn try_lookup_name_relaxed(
&mut self,
err: &mut DiagnosticBuilder<'_, ErrorGuaranteed>,
err: &mut Diagnostic,
source: PathSource<'_>,
path: &[Segment],
span: Span,
Expand Down Expand Up @@ -497,7 +497,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
.contains(span)
{
// Already reported this issue on the lhs of the type ascription.
err.delay_as_bug();
err.downgrade_to_delayed_bug();
return (true, candidates);
}
}
Expand Down Expand Up @@ -616,7 +616,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {

fn suggest_trait_and_bounds(
&mut self,
err: &mut DiagnosticBuilder<'_, ErrorGuaranteed>,
err: &mut Diagnostic,
source: PathSource<'_>,
res: Option<Res>,
span: Span,
Expand Down Expand Up @@ -691,7 +691,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {

fn suggest_typo(
&mut self,
err: &mut DiagnosticBuilder<'_, ErrorGuaranteed>,
err: &mut Diagnostic,
source: PathSource<'_>,
path: &[Segment],
span: Span,
Expand Down Expand Up @@ -750,7 +750,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {

fn err_code_special_cases(
&mut self,
err: &mut DiagnosticBuilder<'_, ErrorGuaranteed>,
err: &mut Diagnostic,
source: PathSource<'_>,
path: &[Segment],
span: Span,
Expand Down Expand Up @@ -1941,7 +1941,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
err.span_suggestions(
span,
&msg,
suggestable_variants.into_iter(),
suggestable_variants,
Applicability::MaybeIncorrect,
);
}
Expand Down Expand Up @@ -1995,7 +1995,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
err.span_suggestions(
span,
msg,
suggestable_variants.into_iter(),
suggestable_variants,
Applicability::MaybeIncorrect,
);
}
Expand Down Expand Up @@ -2025,7 +2025,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
err.span_suggestions(
span,
msg,
suggestable_variants_with_placeholders.into_iter(),
suggestable_variants_with_placeholders,
Applicability::HasPlaceholders,
);
}
Expand Down
44 changes: 44 additions & 0 deletions compiler/rustc_span/src/source_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,50 @@ impl SourceMap {
}
}

/// Given a 'Span', tries to tell if the next character is '>'
/// and the previous charactoer is '<' after skipping white space
/// return true if wrapped by '<>'
pub fn span_wrapped_by_angle_bracket(&self, span: Span) -> bool {
self.span_to_source(span, |src, start_index, end_index| {
if src.get(start_index..end_index).is_none() {
return Ok(false);
}
// test the right side to match '>' after skipping white space
let end_src = &src[end_index..];
let mut i = 0;
while let Some(cc) = end_src.chars().nth(i) {
if cc == ' ' {
i = i + 1;
} else if cc == '>' {
// found > in the right;
break;
} else {
// failed to find '>' return false immediately
return Ok(false);
}
}
// test the left side to match '<' after skipping white space
i = start_index;
let start_src = &src[0..start_index];
while let Some(cc) = start_src.chars().nth(i) {
if cc == ' ' {
if i == 0 {
return Ok(false);
}
i = i - 1;
} else if cc == '<' {
// found < in the left
break;
} else {
// failed to find '<' return false immediately
return Ok(false);
}
}
return Ok(true);
})
.map_or(false, |is_accessible| is_accessible)
}

/// Given a `Span`, tries to get a shorter span ending just after the first occurrence of `char`
/// `c`.
pub fn span_through_char(&self, sp: Span, c: char) -> Span {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
err.span_suggestions(
span.shrink_to_lo(),
"consider borrowing here",
["&".to_string(), "&mut ".to_string()].into_iter(),
["&".to_string(), "&mut ".to_string()],
Applicability::MaybeIncorrect,
);
} else {
Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,7 @@ impl<'a> Builder<'a> {
run::BuildManifest,
run::BumpStage0,
run::ReplaceVersionPlaceholder,
run::Miri,
),
// These commands either don't use paths, or they're special-cased in Build::build()
Kind::Clean | Kind::Format | Kind::Setup => vec![],
Expand Down Expand Up @@ -818,7 +819,7 @@ impl<'a> Builder<'a> {
Subcommand::Bench { ref paths, .. } => (Kind::Bench, &paths[..]),
Subcommand::Dist { ref paths } => (Kind::Dist, &paths[..]),
Subcommand::Install { ref paths } => (Kind::Install, &paths[..]),
Subcommand::Run { ref paths } => (Kind::Run, &paths[..]),
Subcommand::Run { ref paths, .. } => (Kind::Run, &paths[..]),
Subcommand::Format { .. } => (Kind::Format, &[][..]),
Subcommand::Clean { .. } | Subcommand::Setup { .. } => {
panic!()
Expand Down
25 changes: 17 additions & 8 deletions src/bootstrap/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ pub enum Subcommand {
},
Run {
paths: Vec<PathBuf>,
args: Vec<String>,
},
Setup {
profile: Profile,
Expand Down Expand Up @@ -342,6 +343,9 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
Kind::Format => {
opts.optflag("", "check", "check formatting instead of applying.");
}
Kind::Run => {
opts.optmulti("", "args", "arguments for the tool", "ARGS");
}
_ => {}
};

Expand Down Expand Up @@ -613,7 +617,7 @@ Arguments:
println!("\nrun requires at least a path!\n");
usage(1, &opts, verbose, &subcommand_help);
}
Subcommand::Run { paths }
Subcommand::Run { paths, args: matches.opt_strs("args") }
}
Kind::Setup => {
let profile = if paths.len() > 1 {
Expand Down Expand Up @@ -721,24 +725,29 @@ impl Subcommand {
}

pub fn test_args(&self) -> Vec<&str> {
let mut args = vec![];

match *self {
Subcommand::Test { ref test_args, .. } | Subcommand::Bench { ref test_args, .. } => {
args.extend(test_args.iter().flat_map(|s| s.split_whitespace()))
test_args.iter().flat_map(|s| s.split_whitespace()).collect()
}
_ => (),
_ => vec![],
}

args
}

pub fn rustc_args(&self) -> Vec<&str> {
match *self {
Subcommand::Test { ref rustc_args, .. } => {
rustc_args.iter().flat_map(|s| s.split_whitespace()).collect()
}
_ => Vec::new(),
_ => vec![],
}
}

pub fn args(&self) -> Vec<&str> {
match *self {
Subcommand::Run { ref args, .. } => {
args.iter().flat_map(|s| s.split_whitespace()).collect()
}
_ => vec![],
}
}

Expand Down
Loading