aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/bluetooth_traits/blocklist.rs9
-rw-r--r--components/bluetooth_traits/scanfilter.rs8
-rw-r--r--components/config/opts.rs2
-rw-r--r--components/config_plugins/lib.rs4
-rw-r--r--components/devtools_traits/lib.rs2
-rw-r--r--components/hashglobe/src/alloc.rs5
-rw-r--r--components/hashglobe/src/shim.rs1
-rw-r--r--components/hashglobe/src/table.rs6
-rw-r--r--components/msg/constellation_msg.rs2
-rw-r--r--components/net_traits/filemanager_thread.rs2
-rw-r--r--components/net_traits/response.rs2
-rw-r--r--components/script_plugins/lib.rs24
-rw-r--r--components/servo_arc/lib.rs11
-rw-r--r--components/style_derive/to_css.rs2
14 files changed, 37 insertions, 43 deletions
diff --git a/components/bluetooth_traits/blocklist.rs b/components/bluetooth_traits/blocklist.rs
index 836890fb435..94df49af428 100644
--- a/components/bluetooth_traits/blocklist.rs
+++ b/components/bluetooth_traits/blocklist.rs
@@ -8,10 +8,9 @@ use std::cell::RefCell;
use std::collections::HashMap;
use std::string::String;
-const EXCLUDE_READS: &'static str = "exclude-reads";
-const EXCLUDE_WRITES: &'static str = "exclude-writes";
-const VALID_UUID_REGEX: &'static str =
- "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
+const EXCLUDE_READS: &str = "exclude-reads";
+const EXCLUDE_WRITES: &str = "exclude-writes";
+const VALID_UUID_REGEX: &str = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
thread_local!(pub static BLUETOOTH_BLOCKLIST: RefCell<BluetoothBlocklist> =
RefCell::new(BluetoothBlocklist(parse_blocklist())));
@@ -108,5 +107,5 @@ fn parse_blocklist() -> Option<HashMap<String, Blocklist>> {
result.insert(uuid.to_string(), exclude_type);
}
// Step 5
- return Some(result);
+ Some(result)
}
diff --git a/components/bluetooth_traits/scanfilter.rs b/components/bluetooth_traits/scanfilter.rs
index a37733bfa4e..29e6667f8f6 100644
--- a/components/bluetooth_traits/scanfilter.rs
+++ b/components/bluetooth_traits/scanfilter.rs
@@ -44,16 +44,16 @@ impl BluetoothScanfilter {
service_data: Option<ServiceData>,
) -> BluetoothScanfilter {
BluetoothScanfilter {
- name: name,
- name_prefix: name_prefix,
+ name,
+ name_prefix,
services: ServiceUUIDSequence::new(services),
manufacturer_data: manufacturer_data,
- service_data: service_data,
+ service_data,
}
}
pub fn get_name(&self) -> Option<&str> {
- self.name.as_ref().map(|s| s.as_str())
+ self.name.as_deref()
}
pub fn get_name_prefix(&self) -> &str {
diff --git a/components/config/opts.rs b/components/config/opts.rs
index 8228336bae8..513f343cfa0 100644
--- a/components/config/opts.rs
+++ b/components/config/opts.rs
@@ -432,7 +432,7 @@ fn print_debug_usage(app: &str) -> ! {
"Emit native OS signposts for profile events (currently macOS only)",
);
- println!("");
+ println!();
process::exit(0)
}
diff --git a/components/config_plugins/lib.rs b/components/config_plugins/lib.rs
index 1618637ce8b..658db3bb3ac 100644
--- a/components/config_plugins/lib.rs
+++ b/components/config_plugins/lib.rs
@@ -68,7 +68,7 @@ impl Build {
self.path_stack.push(field.name.clone());
if let FieldType::NewTypeDef(new_def) = &field.field_type {
- self.walk(&new_def)?;
+ self.walk(new_def)?;
} else {
let pref_name =
self.pref_name(field, &self.path_stack[..self.path_stack.len() - 1]);
@@ -154,7 +154,7 @@ impl Build {
}
},
FieldType::Existing(type_name) => {
- let pref_name = self.pref_name(field, &path_stack);
+ let pref_name = self.pref_name(field, path_stack);
let attributes = field.get_attributes(&pref_name);
quote! {
#attributes
diff --git a/components/devtools_traits/lib.rs b/components/devtools_traits/lib.rs
index dbdf255b71b..9abbf5d1cc9 100644
--- a/components/devtools_traits/lib.rs
+++ b/components/devtools_traits/lib.rs
@@ -334,7 +334,7 @@ pub enum NetworkEvent {
impl TimelineMarker {
pub fn start(name: String) -> StartedTimelineMarker {
StartedTimelineMarker {
- name: name,
+ name,
start_time: PreciseTime::now(),
start_stack: None,
}
diff --git a/components/hashglobe/src/alloc.rs b/components/hashglobe/src/alloc.rs
index b1c7a6eca5e..89f45a25015 100644
--- a/components/hashglobe/src/alloc.rs
+++ b/components/hashglobe/src/alloc.rs
@@ -36,12 +36,11 @@ mod platform {
#[inline]
pub unsafe fn alloc(size: usize, align: usize) -> *mut u8 {
- let ptr = if align <= MIN_ALIGN {
+ if align <= MIN_ALIGN {
libc::malloc(size) as *mut u8
} else {
aligned_malloc(size, align)
- };
- ptr
+ }
}
#[inline]
diff --git a/components/hashglobe/src/shim.rs b/components/hashglobe/src/shim.rs
index 855dbdcfa15..8b08af871d6 100644
--- a/components/hashglobe/src/shim.rs
+++ b/components/hashglobe/src/shim.rs
@@ -49,6 +49,7 @@ impl<T: 'static> Shared<T> {
}
}
+ #[allow(clippy::mut_from_ref)]
pub unsafe fn as_mut(&self) -> &mut T {
&mut *self.ptr.as_ptr()
}
diff --git a/components/hashglobe/src/table.rs b/components/hashglobe/src/table.rs
index e418c11b04d..de02e09de97 100644
--- a/components/hashglobe/src/table.rs
+++ b/components/hashglobe/src/table.rs
@@ -202,7 +202,7 @@ impl SafeHash {
// effectively reducing the hashes by one bit.
//
// Truncate hash to fit in `HashUint`.
- let hash_bits = size_of::<HashUint>() * 8;
+ let hash_bits = HashUint::BITS;
SafeHash {
hash: (1 << (hash_bits - 1)) | (hash as HashUint),
}
@@ -243,7 +243,7 @@ impl<K, V> RawBucket<K, V> {
self.hash_start.offset(self.idx as isize)
}
unsafe fn pair(&self) -> *mut (K, V) {
- self.pair_start.offset(self.idx as isize) as *mut (K, V)
+ self.pair_start.add(self.idx) as *mut (K, V)
}
unsafe fn hash_pair(&self) -> (*mut HashUint, *mut (K, V)) {
(self.hash(), self.pair())
@@ -824,7 +824,7 @@ impl<K, V> RawTable<K, V> {
unsafe {
RawBucket {
hash_start: buffer as *mut HashUint,
- pair_start: buffer.offset(pairs_offset as isize) as *const (K, V),
+ pair_start: buffer.add(pairs_offset) as *const (K, V),
idx: index,
_marker: marker::PhantomData,
}
diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs
index f1c26142078..61894aa6a8b 100644
--- a/components/msg/constellation_msg.rs
+++ b/components/msg/constellation_msg.rs
@@ -637,7 +637,7 @@ impl fmt::Debug for HangProfile {
write!(fmt, "HangProfile backtrace:")?;
- if self.backtrace.len() == 0 {
+ if self.backtrace.is_empty() {
write!(fmt, "backtrace failed to resolve")?;
return Ok(());
}
diff --git a/components/net_traits/filemanager_thread.rs b/components/net_traits/filemanager_thread.rs
index e89a282fa39..50eb0ded238 100644
--- a/components/net_traits/filemanager_thread.rs
+++ b/components/net_traits/filemanager_thread.rs
@@ -57,7 +57,7 @@ impl RelativePos {
pub fn from_opts(start: Option<i64>, end: Option<i64>) -> RelativePos {
RelativePos {
start: start.unwrap_or(0),
- end: end,
+ end,
}
}
diff --git a/components/net_traits/response.rs b/components/net_traits/response.rs
index 46d2a6751c5..15949731b8f 100644
--- a/components/net_traits/response.rs
+++ b/components/net_traits/response.rs
@@ -226,7 +226,7 @@ impl Response {
/// Convert to a filtered response, of type `filter_type`.
/// Do not use with type Error or Default
- #[cfg_attr(rustfmt, rustfmt_skip)]
+ #[rustfmt::skip]
pub fn to_filtered(self, filter_type: ResponseType) -> Response {
match filter_type {
ResponseType::Default |
diff --git a/components/script_plugins/lib.rs b/components/script_plugins/lib.rs
index 7de352281d7..498e6027cac 100644
--- a/components/script_plugins/lib.rs
+++ b/components/script_plugins/lib.rs
@@ -286,21 +286,21 @@ impl<'tcx> LateLintPass<'tcx> for UnrootedPass {
}
}
- if !in_new_function {
- if is_unrooted_ty(&self.symbols, cx, sig.output().skip_binder(), false) {
- cx.lint(UNROOTED_MUST_ROOT, |lint| {
- lint.build("Type must be rooted")
- .set_span(decl.output.span())
- .emit()
- })
- }
+ if !in_new_function &&
+ is_unrooted_ty(&self.symbols, cx, sig.output().skip_binder(), false)
+ {
+ cx.lint(UNROOTED_MUST_ROOT, |lint| {
+ lint.build("Type must be rooted")
+ .set_span(decl.output.span())
+ .emit()
+ })
}
}
let mut visitor = FnDefVisitor {
symbols: &self.symbols,
- cx: cx,
- in_new_function: in_new_function,
+ cx,
+ in_new_function,
};
visit::walk_expr(&mut visitor, &body.value);
}
@@ -331,7 +331,7 @@ impl<'a, 'tcx> visit::Visitor<'tcx> for FnDefVisitor<'a, 'tcx> {
match expr.kind {
// Trait casts from #[unrooted_must_root_lint::must_root] types are not allowed
- ExprKind::Cast(ref subexpr, _) => require_rooted(cx, self.in_new_function, &*subexpr),
+ ExprKind::Cast(subexpr, _) => require_rooted(cx, self.in_new_function, &subexpr),
// This catches assignments... the main point of this would be to catch mutable
// references to `JS<T>`.
// FIXME: Enable this? Triggers on certain kinds of uses of DomRefCell.
@@ -362,7 +362,7 @@ impl<'a, 'tcx> visit::Visitor<'tcx> for FnDefVisitor<'a, 'tcx> {
hir::PatKind::Binding(hir::BindingAnnotation::Unannotated, ..) |
hir::PatKind::Binding(hir::BindingAnnotation::Mutable, ..) => {
let ty = cx.typeck_results().pat_ty(pat);
- if is_unrooted_ty(&self.symbols, cx, ty, self.in_new_function) {
+ if is_unrooted_ty(self.symbols, cx, ty, self.in_new_function) {
cx.lint(UNROOTED_MUST_ROOT, |lint| {
lint.build(&format!("Expression of type {:?} must be rooted", ty))
.set_span(pat.span)
diff --git a/components/servo_arc/lib.rs b/components/servo_arc/lib.rs
index bd6b5289504..27ea8e9ba71 100644
--- a/components/servo_arc/lib.rs
+++ b/components/servo_arc/lib.rs
@@ -831,6 +831,7 @@ impl<H, T> Arc<HeaderSlice<H, [T]>> {
}
#[inline]
+ #[allow(clippy::uninit_vec)]
unsafe fn allocate_buffer<W>(size: usize) -> *mut u8 {
// We use Vec because the underlying allocation machinery isn't
// available in stable Rust. To avoid alignment issues, we allocate
@@ -1101,9 +1102,7 @@ impl<T> Clone for RawOffsetArc<T> {
impl<T> Drop for RawOffsetArc<T> {
fn drop(&mut self) {
- let _ = Arc::from_raw_offset(RawOffsetArc {
- ptr: self.ptr.clone(),
- });
+ let _ = Arc::from_raw_offset(RawOffsetArc { ptr: self.ptr });
}
}
@@ -1117,10 +1116,6 @@ impl<T: PartialEq> PartialEq for RawOffsetArc<T> {
fn eq(&self, other: &RawOffsetArc<T>) -> bool {
*(*self) == *(*other)
}
-
- fn ne(&self, other: &RawOffsetArc<T>) -> bool {
- *(*self) != *(*other)
- }
}
impl<T> RawOffsetArc<T> {
@@ -1252,7 +1247,7 @@ impl<'a, T> ArcBorrow<'a, T> {
/// Compare two `ArcBorrow`s via pointer equality. Will only return
/// true if they come from the same allocation
pub fn ptr_eq(this: &Self, other: &Self) -> bool {
- this.0 as *const T == other.0 as *const T
+ std::ptr::eq(this.0, other.0)
}
/// Temporarily converts |self| into a bonafide Arc and exposes it to the
diff --git a/components/style_derive/to_css.rs b/components/style_derive/to_css.rs
index 40b7ee7cfec..f939d1d0372 100644
--- a/components/style_derive/to_css.rs
+++ b/components/style_derive/to_css.rs
@@ -123,7 +123,7 @@ fn derive_variant_fields_expr(
let mut iter = bindings
.iter()
.filter_map(|binding| {
- let attrs = cg::parse_field_attrs::<CssFieldAttrs>(&binding.ast());
+ let attrs = cg::parse_field_attrs::<CssFieldAttrs>(binding.ast());
if attrs.skip {
return None;
}