Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
hayd committed Nov 5, 2018
1 parent cee8788 commit 019f6da
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
9 changes: 4 additions & 5 deletions src/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1107,10 +1107,7 @@ fn op_repl_start(
let builder = &mut FlatBufferBuilder::new();
let inner = msg::ReplStartRes::create(
builder,
&msg::ReplStartResArgs {
rid: resource.rid,
..Default::default()
},
&msg::ReplStartResArgs { rid: resource.rid },
);
ok_future(serialize_response(
cmd_id,
Expand All @@ -1135,6 +1132,9 @@ fn op_repl_readline(
let prompt = inner.prompt().unwrap().to_owned();
debug!("op_repl_readline {} {}", rid, prompt);

// Ignore this clippy warning until this issue is addressed:
// https://github.com/rust-lang-nursery/rust-clippy/issues/1684
#[cfg_attr(feature = "cargo-clippy", allow(redundant_closure_call))]
Box::new(futures::future::result((move || {
let line = resources::readline(rid, &prompt)?;

Expand All @@ -1144,7 +1144,6 @@ fn op_repl_readline(
builder,
&msg::ReplReadlineResArgs {
line: Some(line_off),
..Default::default()
},
);
Ok(serialize_response(
Expand Down
6 changes: 3 additions & 3 deletions src/repl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl DenoRepl {
pub fn new(history_file: PathBuf) -> DenoRepl {
let mut repl = DenoRepl {
editor: Editor::<()>::new(),
history_file: history_file,
history_file,
};

repl.load_history();
Expand Down Expand Up @@ -92,7 +92,7 @@ impl DenoRepl {
})
}

pub fn readline(&mut self, prompt: &String) -> DenoResult<String> {
pub fn readline(&mut self, prompt: &str) -> DenoResult<String> {
self
.editor
.readline(&prompt)
Expand All @@ -115,7 +115,7 @@ impl Drop for DenoRepl {
}
}

pub fn history_path(dir: &DenoDir, history_file: &String) -> PathBuf {
pub fn history_path(dir: &DenoDir, history_file: &str) -> PathBuf {
let mut p: PathBuf = dir.root.clone();
p.push(history_file);
p
Expand Down
2 changes: 1 addition & 1 deletion src/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ pub fn add_repl(repl: DenoRepl) -> Resource {

pub fn readline(
rid: ResourceId,
prompt: &String, // TODO use &str for prompt
prompt: &str,
) -> DenoResult<String> {
let mut table = RESOURCE_TABLE.lock().unwrap();
let maybe_repr = table.get_mut(&rid);
Expand Down

0 comments on commit 019f6da

Please sign in to comment.