summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbokuweb <bokuweb@users.noreply.github.com>2019-02-09 01:14:33 +0900
committerRyan Dahl <ry@tinyclouds.org>2019-02-08 11:14:33 -0500
commitca397f6793604a2988fce5577b2085abd20d646a (patch)
tree341c1180536532ebd5d8fc61a90ea4b61b741c20 /src
parent46804e50ed3941cba9a7c6b12c77c73c988ddf62 (diff)
fix clippy warnings (#1711)
Diffstat (limited to 'src')
-rw-r--r--src/ansi.rs2
-rw-r--r--src/js_errors.rs8
-rw-r--r--src/ops.rs17
3 files changed, 16 insertions, 11 deletions
diff --git a/src/ansi.rs b/src/ansi.rs
index 47bf6c941..e25a8257d 100644
--- a/src/ansi.rs
+++ b/src/ansi.rs
@@ -25,7 +25,7 @@ pub fn strip_ansi_codes(s: &str) -> Cow<str> {
}
pub fn use_color() -> bool {
- *NO_COLOR == false
+ !(*NO_COLOR)
}
pub fn red_bold(s: String) -> impl fmt::Display {
diff --git a/src/js_errors.rs b/src/js_errors.rs
index bc7f37683..dccda0e5d 100644
--- a/src/js_errors.rs
+++ b/src/js_errors.rs
@@ -115,7 +115,7 @@ impl fmt::Display for JSError {
s.push(' ');
}
}
- write!(f, "{}\n", ansi::red_bold(s))?;
+ writeln!(f, "{}", ansi::red_bold(s))?;
}
}
}
@@ -193,7 +193,7 @@ impl StackFrame {
Some(StackFrame {
line: line - 1,
column: column - 1,
- script_name: script_name,
+ script_name,
function_name,
is_eval,
is_constructor,
@@ -227,8 +227,8 @@ impl StackFrame {
let orig_source = sm.sources[original.source as usize].clone();
(
orig_source,
- original.original_line as i64,
- original.original_column as i64,
+ i64::from(original.original_line),
+ i64::from(original.original_column),
)
}
},
diff --git a/src/ops.rs b/src/ops.rs
index b30473eb6..82d79fc2f 100644
--- a/src/ops.rs
+++ b/src/ops.rs
@@ -184,11 +184,11 @@ fn op_now(
assert_eq!(data.len(), 0);
let start = SystemTime::now();
let since_the_epoch = start.duration_since(UNIX_EPOCH).unwrap();
- let time = since_the_epoch.as_secs() as u64 * 1000
- + since_the_epoch.subsec_millis() as u64;
+ let time = since_the_epoch.as_secs() * 1000
+ + u64::from(since_the_epoch.subsec_millis());
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(
base.cmd_id(),
builder,
@@ -327,7 +327,6 @@ fn op_code_fetch(
filename: Some(builder.create_string(&out.filename)),
media_type: out.media_type,
source_code: Some(builder.create_string(&out.source_code)),
- ..Default::default()
};
let inner = msg::CodeFetchRes::create(builder, &msg_args);
Ok(serialize_response(
@@ -622,9 +621,15 @@ fn op_chmod(
#[cfg(any(unix))]
{
// 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();
- #[cfg_attr(feature = "cargo-clippy", allow(used_underscore_binding))]
+ #[cfg_attr(
+ feature = "cargo-clippy",
+ allow(clippy::used_underscore_binding)
+ )]
permissions.set_mode(_mode);
fs::set_permissions(&path, permissions)?;
}