Skip to content

Commit b784958

Browse files
authored
Merge pull request #989 from rust-lang/clean-more
2 parents bc6ca26 + 2c54acd commit b784958

File tree

3 files changed

+0
-364
lines changed

3 files changed

+0
-364
lines changed

ui/src/main.rs

Lines changed: 0 additions & 194 deletions
Original file line numberDiff line numberDiff line change
@@ -202,18 +202,6 @@ enum Error {
202202
},
203203

204204
// Remove at a later point. From here ...
205-
#[snafu(display("The value {:?} is not a valid target", value))]
206-
InvalidTarget { value: String },
207-
#[snafu(display("The value {:?} is not a valid assembly flavor", value))]
208-
InvalidAssemblyFlavor { value: String },
209-
#[snafu(display("The value {:?} is not a valid demangle option", value))]
210-
InvalidDemangleAssembly { value: String },
211-
#[snafu(display("The value {:?} is not a valid assembly processing option", value))]
212-
InvalidProcessAssembly { value: String },
213-
#[snafu(display("The value {:?} is not a valid channel", value,))]
214-
InvalidChannel { value: String },
215-
#[snafu(display("The value {:?} is not a valid mode", value))]
216-
InvalidMode { value: String },
217205
#[snafu(display("The value {:?} is not a valid edition", value))]
218206
InvalidEdition { value: String },
219207
#[snafu(display("The value {:?} is not a valid crate type", value))]
@@ -429,86 +417,6 @@ struct EvaluateResponse {
429417
error: Option<String>,
430418
}
431419

432-
impl TryFrom<CompileRequest> for sandbox::CompileRequest {
433-
type Error = Error;
434-
435-
fn try_from(me: CompileRequest) -> Result<Self> {
436-
let target = parse_target(&me.target)?;
437-
let assembly_flavor = match me.assembly_flavor {
438-
Some(f) => Some(parse_assembly_flavor(&f)?),
439-
None => None,
440-
};
441-
442-
let demangle = match me.demangle_assembly {
443-
Some(f) => Some(parse_demangle_assembly(&f)?),
444-
None => None,
445-
};
446-
447-
let process_assembly = match me.process_assembly {
448-
Some(f) => Some(parse_process_assembly(&f)?),
449-
None => None,
450-
};
451-
452-
let target = match (target, assembly_flavor, demangle, process_assembly) {
453-
(
454-
sandbox::CompileTarget::Assembly(_, _, _),
455-
Some(flavor),
456-
Some(demangle),
457-
Some(process),
458-
) => sandbox::CompileTarget::Assembly(flavor, demangle, process),
459-
_ => target,
460-
};
461-
462-
Ok(sandbox::CompileRequest {
463-
target,
464-
channel: parse_channel(&me.channel)?,
465-
mode: parse_mode(&me.mode)?,
466-
edition: parse_edition(&me.edition)?,
467-
crate_type: parse_crate_type(&me.crate_type)?,
468-
tests: me.tests,
469-
backtrace: me.backtrace,
470-
code: me.code,
471-
})
472-
}
473-
}
474-
475-
impl From<sandbox::CompileResponse> for CompileResponse {
476-
fn from(me: sandbox::CompileResponse) -> Self {
477-
CompileResponse {
478-
success: me.success,
479-
code: me.code,
480-
stdout: me.stdout,
481-
stderr: me.stderr,
482-
}
483-
}
484-
}
485-
486-
impl TryFrom<ExecuteRequest> for sandbox::ExecuteRequest {
487-
type Error = Error;
488-
489-
fn try_from(me: ExecuteRequest) -> Result<Self> {
490-
Ok(sandbox::ExecuteRequest {
491-
channel: parse_channel(&me.channel)?,
492-
mode: parse_mode(&me.mode)?,
493-
edition: parse_edition(&me.edition)?,
494-
crate_type: parse_crate_type(&me.crate_type)?,
495-
tests: me.tests,
496-
backtrace: me.backtrace,
497-
code: me.code,
498-
})
499-
}
500-
}
501-
502-
impl From<sandbox::ExecuteResponse> for ExecuteResponse {
503-
fn from(me: sandbox::ExecuteResponse) -> Self {
504-
ExecuteResponse {
505-
success: me.success,
506-
stdout: me.stdout,
507-
stderr: me.stderr,
508-
}
509-
}
510-
}
511-
512420
impl TryFrom<FormatRequest> for sandbox::FormatRequest {
513421
type Error = Error;
514422

@@ -630,108 +538,6 @@ impl From<gist::Gist> for MetaGistResponse {
630538
}
631539
}
632540

633-
impl TryFrom<EvaluateRequest> for sandbox::ExecuteRequest {
634-
type Error = Error;
635-
636-
fn try_from(me: EvaluateRequest) -> Result<Self> {
637-
Ok(sandbox::ExecuteRequest {
638-
channel: parse_channel(&me.version)?,
639-
mode: if me.optimize != "0" {
640-
sandbox::Mode::Release
641-
} else {
642-
sandbox::Mode::Debug
643-
},
644-
edition: parse_edition(&me.edition)?,
645-
crate_type: sandbox::CrateType::Binary,
646-
tests: me.tests,
647-
backtrace: false,
648-
code: me.code,
649-
})
650-
}
651-
}
652-
653-
impl From<sandbox::ExecuteResponse> for EvaluateResponse {
654-
fn from(me: sandbox::ExecuteResponse) -> Self {
655-
// The old playground didn't use Cargo, so it never had the
656-
// Cargo output ("Compiling playground...") which is printed
657-
// to stderr. Since this endpoint is used to inline results on
658-
// the page, don't include the stderr unless an error
659-
// occurred.
660-
if me.success {
661-
EvaluateResponse {
662-
result: me.stdout,
663-
error: None,
664-
}
665-
} else {
666-
// When an error occurs, *some* consumers check for an
667-
// `error` key, others assume that the error is crammed in
668-
// the `result` field and then they string search for
669-
// `error:` or `warning:`. Ew. We can put it in both.
670-
let result = me.stderr + &me.stdout;
671-
EvaluateResponse {
672-
result: result.clone(),
673-
error: Some(result),
674-
}
675-
}
676-
}
677-
}
678-
679-
fn parse_target(s: &str) -> Result<sandbox::CompileTarget> {
680-
Ok(match s {
681-
"asm" => sandbox::CompileTarget::Assembly(
682-
sandbox::AssemblyFlavor::Att,
683-
sandbox::DemangleAssembly::Demangle,
684-
sandbox::ProcessAssembly::Filter,
685-
),
686-
"llvm-ir" => sandbox::CompileTarget::LlvmIr,
687-
"mir" => sandbox::CompileTarget::Mir,
688-
"hir" => sandbox::CompileTarget::Hir,
689-
"wasm" => sandbox::CompileTarget::Wasm,
690-
value => InvalidTargetSnafu { value }.fail()?,
691-
})
692-
}
693-
694-
fn parse_assembly_flavor(s: &str) -> Result<sandbox::AssemblyFlavor> {
695-
Ok(match s {
696-
"att" => sandbox::AssemblyFlavor::Att,
697-
"intel" => sandbox::AssemblyFlavor::Intel,
698-
value => InvalidAssemblyFlavorSnafu { value }.fail()?,
699-
})
700-
}
701-
702-
fn parse_demangle_assembly(s: &str) -> Result<sandbox::DemangleAssembly> {
703-
Ok(match s {
704-
"demangle" => sandbox::DemangleAssembly::Demangle,
705-
"mangle" => sandbox::DemangleAssembly::Mangle,
706-
value => InvalidDemangleAssemblySnafu { value }.fail()?,
707-
})
708-
}
709-
710-
fn parse_process_assembly(s: &str) -> Result<sandbox::ProcessAssembly> {
711-
Ok(match s {
712-
"filter" => sandbox::ProcessAssembly::Filter,
713-
"raw" => sandbox::ProcessAssembly::Raw,
714-
value => InvalidProcessAssemblySnafu { value }.fail()?,
715-
})
716-
}
717-
718-
fn parse_channel(s: &str) -> Result<sandbox::Channel> {
719-
Ok(match s {
720-
"stable" => sandbox::Channel::Stable,
721-
"beta" => sandbox::Channel::Beta,
722-
"nightly" => sandbox::Channel::Nightly,
723-
value => InvalidChannelSnafu { value }.fail()?,
724-
})
725-
}
726-
727-
fn parse_mode(s: &str) -> Result<sandbox::Mode> {
728-
Ok(match s {
729-
"debug" => sandbox::Mode::Debug,
730-
"release" => sandbox::Mode::Release,
731-
value => InvalidModeSnafu { value }.fail()?,
732-
})
733-
}
734-
735541
fn parse_edition(s: &str) -> Result<Option<sandbox::Edition>> {
736542
Ok(match s {
737543
"" => None,

ui/src/metrics.rs

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -197,61 +197,6 @@ where
197197
}
198198
}
199199

200-
impl GenerateLabels for sandbox::CompileRequest {
201-
fn generate_labels(&self, outcome: Outcome) -> Labels {
202-
let Self {
203-
target,
204-
channel,
205-
crate_type,
206-
mode,
207-
edition,
208-
tests,
209-
backtrace,
210-
code: _,
211-
} = *self;
212-
213-
Labels {
214-
endpoint: Endpoint::Compile,
215-
outcome,
216-
217-
target: Some(target),
218-
channel: Some(channel),
219-
mode: Some(mode),
220-
edition: Some(edition),
221-
crate_type: Some(crate_type),
222-
tests: Some(tests),
223-
backtrace: Some(backtrace),
224-
}
225-
}
226-
}
227-
228-
impl GenerateLabels for sandbox::ExecuteRequest {
229-
fn generate_labels(&self, outcome: Outcome) -> Labels {
230-
let Self {
231-
channel,
232-
mode,
233-
edition,
234-
crate_type,
235-
tests,
236-
backtrace,
237-
code: _,
238-
} = *self;
239-
240-
Labels {
241-
endpoint: Endpoint::Execute,
242-
outcome,
243-
244-
target: None,
245-
channel: Some(channel),
246-
mode: Some(mode),
247-
edition: Some(edition),
248-
crate_type: Some(crate_type),
249-
tests: Some(tests),
250-
backtrace: Some(backtrace),
251-
}
252-
}
253-
}
254-
255200
impl GenerateLabels for sandbox::FormatRequest {
256201
fn generate_labels(&self, outcome: Outcome) -> Labels {
257202
let Self { edition, code: _ } = *self;
@@ -368,18 +313,6 @@ fn common_success_details(success: bool, stderr: &str) -> Outcome {
368313
}
369314
}
370315

371-
impl SuccessDetails for sandbox::CompileResponse {
372-
fn success_details(&self) -> Outcome {
373-
common_success_details(self.success, &self.stderr)
374-
}
375-
}
376-
377-
impl SuccessDetails for sandbox::ExecuteResponse {
378-
fn success_details(&self) -> Outcome {
379-
common_success_details(self.success, &self.stderr)
380-
}
381-
}
382-
383316
impl SuccessDetails for sandbox::FormatResponse {
384317
fn success_details(&self) -> Outcome {
385318
common_success_details(self.success, &self.stderr)

0 commit comments

Comments
 (0)