Avoid unnecessary String

This commit is contained in:
greg 2019-03-19 19:01:04 -07:00
parent 81323cafd4
commit d3f9430a18
3 changed files with 4 additions and 5 deletions

View File

@ -80,7 +80,7 @@ impl Schala {
let prelude = include_str!("prelude.schala");
let mut s = Schala::new_blank_env();
let request = ComputationRequest { source: prelude.to_string(), debug_requests: vec![] };
let request = ComputationRequest { source: prelude, debug_requests: vec![] };
s.run_computation(request);
s
}

View File

@ -17,9 +17,8 @@ pub trait ProgrammingLanguageInterface {
}
}
//TODO source can probably be a &str
pub struct ComputationRequest {
pub source: String,
pub struct ComputationRequest<'a> {
pub source: &'a str,
pub debug_requests: Vec<DebugRequest>,
}

View File

@ -175,7 +175,7 @@ impl Repl {
let ref mut language_state = self.get_cur_language_state();
let request = ComputationRequest {
source: input.to_string(),
source: input,
debug_requests: vec![],
};