mirror of
https://github.com/servo/servo.git
synced 2025-08-02 12:10:29 +01:00
Auto merge of #19868 - CYBAI:specific-assertion, r=emilio
Use specific assertions Similar to #19865 r? jdm Note: Should I squash all the commits into one commit? --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes do not require tests because it should not break anything <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19868) <!-- Reviewable:end -->
This commit is contained in:
commit
c9ba16f9fb
40 changed files with 90 additions and 90 deletions
|
@ -234,7 +234,7 @@ pub unsafe fn create_named_constructors(
|
|||
rooted!(in(cx) let mut constructor = ptr::null_mut::<JSObject>());
|
||||
|
||||
for &(native, name, arity) in named_constructors {
|
||||
assert!(*name.last().unwrap() == b'\0');
|
||||
assert_eq!(*name.last().unwrap(), b'\0');
|
||||
|
||||
let fun = JS_NewFunction(cx,
|
||||
Some(native),
|
||||
|
@ -324,7 +324,7 @@ pub unsafe fn define_on_global_object(
|
|||
global: HandleObject,
|
||||
name: &[u8],
|
||||
obj: HandleObject) {
|
||||
assert!(*name.last().unwrap() == b'\0');
|
||||
assert_eq!(*name.last().unwrap(), b'\0');
|
||||
assert!(JS_DefineProperty1(cx,
|
||||
global,
|
||||
name.as_ptr() as *const libc::c_char,
|
||||
|
@ -429,7 +429,7 @@ unsafe fn create_unscopable_object(
|
|||
rval.set(JS_NewPlainObject(cx));
|
||||
assert!(!rval.ptr.is_null());
|
||||
for &name in names {
|
||||
assert!(*name.last().unwrap() == b'\0');
|
||||
assert_eq!(*name.last().unwrap(), b'\0');
|
||||
assert!(JS_DefineProperty(
|
||||
cx, rval.handle(), name.as_ptr() as *const libc::c_char, TrueHandleValue,
|
||||
JSPROP_READONLY, None, None));
|
||||
|
@ -437,7 +437,7 @@ unsafe fn create_unscopable_object(
|
|||
}
|
||||
|
||||
unsafe fn define_name(cx: *mut JSContext, obj: HandleObject, name: &[u8]) {
|
||||
assert!(*name.last().unwrap() == b'\0');
|
||||
assert_eq!(*name.last().unwrap(), b'\0');
|
||||
rooted!(in(cx) let name = JS_AtomizeAndPinString(cx, name.as_ptr() as *const libc::c_char));
|
||||
assert!(!name.is_null());
|
||||
assert!(JS_DefineProperty2(cx,
|
||||
|
|
|
@ -98,7 +98,7 @@ impl TrustedPromise {
|
|||
LIVE_REFERENCES.with(|ref r| {
|
||||
let r = r.borrow();
|
||||
let live_references = r.as_ref().unwrap();
|
||||
assert!(self.owner_thread == (&*live_references) as *const _ as *const libc::c_void);
|
||||
assert_eq!(self.owner_thread, (&*live_references) as *const _ as *const libc::c_void);
|
||||
// Borrow-check error requires the redundant `let promise = ...; promise` here.
|
||||
let promise = match live_references.promise_table.borrow_mut().entry(self.dom_object) {
|
||||
Occupied(mut entry) => {
|
||||
|
|
|
@ -115,7 +115,7 @@ unsafe impl Sync for DOMJSClass {}
|
|||
/// Fails if `global` is not a DOM global object.
|
||||
pub fn get_proto_or_iface_array(global: *mut JSObject) -> *mut ProtoOrIfaceArray {
|
||||
unsafe {
|
||||
assert!(((*get_object_class(global)).flags & JSCLASS_DOM_GLOBAL) != 0);
|
||||
assert_ne!(((*get_object_class(global)).flags & JSCLASS_DOM_GLOBAL), 0);
|
||||
JS_GetReservedSlot(global, DOM_PROTOTYPE_SLOT).to_private() as *mut ProtoOrIfaceArray
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue