1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-18 11:53:59 -05:00

fix clippy warnings (#1711)

This commit is contained in:
bokuweb 2019-02-09 01:14:33 +09:00 committed by Ryan Dahl
parent 46804e50ed
commit ca397f6793
3 changed files with 16 additions and 11 deletions

View file

@ -25,7 +25,7 @@ pub fn strip_ansi_codes(s: &str) -> Cow<str> {
} }
pub fn use_color() -> bool { pub fn use_color() -> bool {
*NO_COLOR == false !(*NO_COLOR)
} }
pub fn red_bold(s: String) -> impl fmt::Display { pub fn red_bold(s: String) -> impl fmt::Display {

View file

@ -115,7 +115,7 @@ impl fmt::Display for JSError {
s.push(' '); s.push(' ');
} }
} }
write!(f, "{}\n", ansi::red_bold(s))?; writeln!(f, "{}", ansi::red_bold(s))?;
} }
} }
} }
@ -193,7 +193,7 @@ impl StackFrame {
Some(StackFrame { Some(StackFrame {
line: line - 1, line: line - 1,
column: column - 1, column: column - 1,
script_name: script_name, script_name,
function_name, function_name,
is_eval, is_eval,
is_constructor, is_constructor,
@ -227,8 +227,8 @@ impl StackFrame {
let orig_source = sm.sources[original.source as usize].clone(); let orig_source = sm.sources[original.source as usize].clone();
( (
orig_source, orig_source,
original.original_line as i64, i64::from(original.original_line),
original.original_column as i64, i64::from(original.original_column),
) )
} }
}, },

View file

@ -184,11 +184,11 @@ fn op_now(
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
let start = SystemTime::now(); let start = SystemTime::now();
let since_the_epoch = start.duration_since(UNIX_EPOCH).unwrap(); let since_the_epoch = start.duration_since(UNIX_EPOCH).unwrap();
let time = since_the_epoch.as_secs() as u64 * 1000 let time = since_the_epoch.as_secs() * 1000
+ since_the_epoch.subsec_millis() as u64; + u64::from(since_the_epoch.subsec_millis());
let builder = &mut FlatBufferBuilder::new(); let builder = &mut FlatBufferBuilder::new();
let inner = msg::NowRes::create(builder, &msg::NowResArgs { time: time }); let inner = msg::NowRes::create(builder, &msg::NowResArgs { time });
ok_future(serialize_response( ok_future(serialize_response(
base.cmd_id(), base.cmd_id(),
builder, builder,
@ -327,7 +327,6 @@ fn op_code_fetch(
filename: Some(builder.create_string(&out.filename)), filename: Some(builder.create_string(&out.filename)),
media_type: out.media_type, media_type: out.media_type,
source_code: Some(builder.create_string(&out.source_code)), source_code: Some(builder.create_string(&out.source_code)),
..Default::default()
}; };
let inner = msg::CodeFetchRes::create(builder, &msg_args); let inner = msg::CodeFetchRes::create(builder, &msg_args);
Ok(serialize_response( Ok(serialize_response(
@ -622,9 +621,15 @@ fn op_chmod(
#[cfg(any(unix))] #[cfg(any(unix))]
{ {
// We need to use underscore to compile in Windows. // We need to use underscore to compile in Windows.
#[cfg_attr(feature = "cargo-clippy", allow(used_underscore_binding))] #[cfg_attr(
feature = "cargo-clippy",
allow(clippy::used_underscore_binding)
)]
let mut permissions = _metadata.permissions(); let mut permissions = _metadata.permissions();
#[cfg_attr(feature = "cargo-clippy", allow(used_underscore_binding))] #[cfg_attr(
feature = "cargo-clippy",
allow(clippy::used_underscore_binding)
)]
permissions.set_mode(_mode); permissions.set_mode(_mode);
fs::set_permissions(&path, permissions)?; fs::set_permissions(&path, permissions)?;
} }