зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #19868 - Use specific assertions (from CYBAI:specific-assertion); r=emilio
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 Source-Repo: https://github.com/servo/servo Source-Revision: c9ba16f9fbdf7f43cb19feedfaaa68c85bbcbe3b --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : f1c9a3696d90aab078d6e2b96318d1ccc8a28507
This commit is contained in:
Родитель
dc8c14e96a
Коммит
aba250b512
|
@ -648,7 +648,7 @@ impl<'a> CanvasPaintThread<'a> {
|
|||
return
|
||||
}
|
||||
|
||||
assert!(image_data_size.width * image_data_size.height * 4.0 == imagedata.len() as f64);
|
||||
assert_eq!(image_data_size.width * image_data_size.height * 4.0, imagedata.len() as f64);
|
||||
|
||||
// Step 1. TODO (neutered data)
|
||||
|
||||
|
|
|
@ -888,7 +888,7 @@ impl WebGLImpl {
|
|||
// TODO: update test expectations in order to enable debug assertions
|
||||
//if cfg!(debug_assertions) {
|
||||
let error = ctx.gl().get_error();
|
||||
assert!(error == gl::NO_ERROR, "Unexpected WebGL error: 0x{:x} ({})", error, error);
|
||||
assert_eq!(error, gl::NO_ERROR, "Unexpected WebGL error: 0x{:x} ({})", error, error);
|
||||
//}
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ impl ConvertPipelineIdFromWebRender for webrender_api::PipelineId {
|
|||
|
||||
/// Holds the state when running reftests that determines when it is
|
||||
/// safe to save the output image.
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
enum ReadyState {
|
||||
Unknown,
|
||||
WaitingForConstellationReply,
|
||||
|
@ -495,7 +495,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
}
|
||||
|
||||
(Msg::IsReadyToSaveImageReply(is_ready), ShutdownState::NotShuttingDown) => {
|
||||
assert!(self.ready_to_save_state == ReadyState::WaitingForConstellationReply);
|
||||
assert_eq!(self.ready_to_save_state, ReadyState::WaitingForConstellationReply);
|
||||
if is_ready {
|
||||
self.ready_to_save_state = ReadyState::ReadyToSaveImage;
|
||||
if opts::get().is_running_problem_test {
|
||||
|
|
|
@ -913,7 +913,7 @@ lazy_static! {
|
|||
pub fn set_defaults(opts: Opts) {
|
||||
unsafe {
|
||||
assert!(DEFAULT_OPTIONS.is_null());
|
||||
assert!(DEFAULT_OPTIONS != INVALID_OPTIONS);
|
||||
assert_ne!(DEFAULT_OPTIONS, INVALID_OPTIONS);
|
||||
let box_opts = Box::new(opts);
|
||||
DEFAULT_OPTIONS = Box::into_raw(box_opts);
|
||||
}
|
||||
|
|
|
@ -322,7 +322,7 @@ impl<'a> FontHandle {
|
|||
let x_scale = (metrics.x_ppem as f64) / em_size as f64;
|
||||
|
||||
// If this isn't true then we're scaling one of the axes wrong
|
||||
assert!(metrics.x_ppem == metrics.y_ppem);
|
||||
assert_eq!(metrics.x_ppem, metrics.y_ppem);
|
||||
|
||||
Au::from_f64_px(value * x_scale)
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ pub fn for_each_variation<F>(family_name: &str, mut callback: F)
|
|||
let family_name_c = CString::new(family_name).unwrap();
|
||||
let family_name = family_name_c.as_ptr();
|
||||
let ok = FcPatternAddString(pattern, FC_FAMILY.as_ptr() as *mut c_char, family_name as *mut FcChar8);
|
||||
assert!(ok != 0);
|
||||
assert_ne!(ok, 0);
|
||||
|
||||
let object_set = FcObjectSetCreate();
|
||||
assert!(!object_set.is_null());
|
||||
|
|
|
@ -247,7 +247,7 @@ impl FontHandleMethods for FontHandle {
|
|||
return None;
|
||||
}
|
||||
|
||||
assert!(glyphs[0] != 0); // FIXME: error handling
|
||||
assert_ne!(glyphs[0], 0); // FIXME: error handling
|
||||
return Some(glyphs[0] as GlyphId);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ impl ShapedGlyphData {
|
|||
let mut pos_count = 0;
|
||||
let pos_infos = hb_buffer_get_glyph_positions(buffer, &mut pos_count);
|
||||
assert!(!pos_infos.is_null());
|
||||
assert!(glyph_count == pos_count);
|
||||
assert_eq!(glyph_count, pos_count);
|
||||
|
||||
ShapedGlyphData {
|
||||
count: glyph_count as usize,
|
||||
|
|
|
@ -2645,7 +2645,7 @@ mod test_map {
|
|||
m2.insert(1, 2);
|
||||
m2.insert(2, 3);
|
||||
|
||||
assert!(m1 != m2);
|
||||
assert_ne!(m1, m2);
|
||||
|
||||
m2.insert(3, 4);
|
||||
|
||||
|
|
|
@ -1450,7 +1450,7 @@ mod test_set {
|
|||
s2.insert(1);
|
||||
s2.insert(2);
|
||||
|
||||
assert!(s1 != s2);
|
||||
assert_ne!(s1, s2);
|
||||
|
||||
s2.insert(3);
|
||||
|
||||
|
@ -1496,7 +1496,7 @@ mod test_set {
|
|||
let mut d = s.drain();
|
||||
for (i, x) in d.by_ref().take(50).enumerate() {
|
||||
last_i = i;
|
||||
assert!(x != 0);
|
||||
assert_ne!(x, 0);
|
||||
}
|
||||
assert_eq!(last_i, 49);
|
||||
}
|
||||
|
|
|
@ -364,8 +364,8 @@ impl Floats {
|
|||
}
|
||||
}
|
||||
Some(rect) => {
|
||||
assert!(rect.start.b + rect.size.block != float_b,
|
||||
"Non-terminating float placement");
|
||||
assert_ne!(rect.start.b + rect.size.block, float_b,
|
||||
"Non-terminating float placement");
|
||||
|
||||
// Place here if there is enough room
|
||||
if rect.size.inline >= info.size.inline {
|
||||
|
|
|
@ -114,7 +114,7 @@ pub fn begin_trace(flow_root: FlowRef) {
|
|||
/// file can then be viewed with an external tool.
|
||||
pub fn end_trace(generation: u32) {
|
||||
let mut thread_state = STATE_KEY.with(|ref r| r.borrow_mut().take().unwrap());
|
||||
assert!(thread_state.scope_stack.len() == 1);
|
||||
assert_eq!(thread_state.scope_stack.len(), 1);
|
||||
let mut root_scope = thread_state.scope_stack.pop().unwrap();
|
||||
root_scope.post = to_value(&thread_state.flow_root.base()).unwrap();
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ impl Flow for MulticolFlow {
|
|||
});
|
||||
|
||||
// Before layout, everything is in a single "column"
|
||||
assert!(self.block_flow.base.children.len() == 1);
|
||||
assert_eq!(self.block_flow.base.children.len(), 1);
|
||||
let mut column = self.block_flow.base.children.pop_front_arc().unwrap();
|
||||
|
||||
// Pretend there is no children for this:
|
||||
|
|
|
@ -442,7 +442,7 @@ fn wait_for_response(response: &mut Response, target: Target, done_chan: &mut Do
|
|||
// We should still send the body across as a chunk
|
||||
target.process_response_chunk(vec.clone());
|
||||
} else {
|
||||
assert!(*body == ResponseBody::Empty)
|
||||
assert_eq!(*body, ResponseBody::Empty)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -585,7 +585,7 @@ impl HttpCache {
|
|||
/// Freshening Stored Responses upon Validation.
|
||||
/// <https://tools.ietf.org/html/rfc7234#section-4.3.4>
|
||||
pub fn refresh(&mut self, request: &Request, response: Response, done_chan: &mut DoneChannel) -> Option<Response> {
|
||||
assert!(response.status == Some(StatusCode::NotModified));
|
||||
assert_eq!(response.status, Some(StatusCode::NotModified));
|
||||
let entry_key = CacheKey::new(request.clone());
|
||||
if let Some(cached_resources) = self.entries.get_mut(&entry_key) {
|
||||
for cached_resource in cached_resources.iter_mut() {
|
||||
|
|
|
@ -44,13 +44,13 @@ fn test_path_match() {
|
|||
|
||||
#[test]
|
||||
fn test_default_path() {
|
||||
assert!(&*Cookie::default_path("/foo/bar/baz/") == "/foo/bar/baz");
|
||||
assert!(&*Cookie::default_path("/foo/bar/baz") == "/foo/bar");
|
||||
assert!(&*Cookie::default_path("/foo/") == "/foo");
|
||||
assert!(&*Cookie::default_path("/foo") == "/");
|
||||
assert!(&*Cookie::default_path("/") == "/");
|
||||
assert!(&*Cookie::default_path("") == "/");
|
||||
assert!(&*Cookie::default_path("foo") == "/");
|
||||
assert_eq!(&*Cookie::default_path("/foo/bar/baz/"), "/foo/bar/baz");
|
||||
assert_eq!(&*Cookie::default_path("/foo/bar/baz"), "/foo/bar");
|
||||
assert_eq!(&*Cookie::default_path("/foo/"), "/foo");
|
||||
assert_eq!(&*Cookie::default_path("/foo"), "/");
|
||||
assert_eq!(&*Cookie::default_path("/"), "/");
|
||||
assert_eq!(&*Cookie::default_path(""), "/");
|
||||
assert_eq!(&*Cookie::default_path("foo"), "/");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -69,7 +69,7 @@ fn fn_cookie_constructor() {
|
|||
let cookie = cookie_rs::Cookie::parse(" baz = bar; Domain = ").unwrap();
|
||||
assert!(Cookie::new_wrapped(cookie.clone(), url, CookieSource::HTTP).is_some());
|
||||
let cookie = Cookie::new_wrapped(cookie, url, CookieSource::HTTP).unwrap();
|
||||
assert!(&**cookie.cookie.domain().as_ref().unwrap() == "example.com");
|
||||
assert_eq!(&**cookie.cookie.domain().as_ref().unwrap(), "example.com");
|
||||
|
||||
// cookie public domains test
|
||||
let cookie = cookie_rs::Cookie::parse(" baz = bar; Domain = gov.ac").unwrap();
|
||||
|
@ -88,11 +88,11 @@ fn fn_cookie_constructor() {
|
|||
|
||||
let cookie = cookie_rs::Cookie::parse(" baz = bar ; Secure; Path = /foo/bar/").unwrap();
|
||||
let cookie = Cookie::new_wrapped(cookie, url, CookieSource::HTTP).unwrap();
|
||||
assert!(cookie.cookie.value() == "bar");
|
||||
assert!(cookie.cookie.name() == "baz");
|
||||
assert_eq!(cookie.cookie.value(), "bar");
|
||||
assert_eq!(cookie.cookie.name(), "baz");
|
||||
assert!(cookie.cookie.secure());
|
||||
assert!(&cookie.cookie.path().as_ref().unwrap()[..] == "/foo/bar/");
|
||||
assert!(&cookie.cookie.domain().as_ref().unwrap()[..] == "example.com");
|
||||
assert_eq!(&cookie.cookie.path().as_ref().unwrap()[..], "/foo/bar/");
|
||||
assert_eq!(&cookie.cookie.domain().as_ref().unwrap()[..], "example.com");
|
||||
assert!(cookie.host_only);
|
||||
|
||||
let u = &ServoUrl::parse("http://example.com/foobar").unwrap();
|
||||
|
@ -192,11 +192,11 @@ fn test_sort_order() {
|
|||
let b = Cookie::new_wrapped(b, url, CookieSource::HTTP).unwrap();
|
||||
|
||||
assert!(b.cookie.path().as_ref().unwrap().len() > a.cookie.path().as_ref().unwrap().len());
|
||||
assert!(CookieStorage::cookie_comparator(&a, &b) == Ordering::Greater);
|
||||
assert!(CookieStorage::cookie_comparator(&b, &a) == Ordering::Less);
|
||||
assert!(CookieStorage::cookie_comparator(&a, &a_prime) == Ordering::Less);
|
||||
assert!(CookieStorage::cookie_comparator(&a_prime, &a) == Ordering::Greater);
|
||||
assert!(CookieStorage::cookie_comparator(&a, &a) == Ordering::Equal);
|
||||
assert_eq!(CookieStorage::cookie_comparator(&a, &b), Ordering::Greater);
|
||||
assert_eq!(CookieStorage::cookie_comparator(&b, &a), Ordering::Less);
|
||||
assert_eq!(CookieStorage::cookie_comparator(&a, &a_prime), Ordering::Less);
|
||||
assert_eq!(CookieStorage::cookie_comparator(&a_prime, &a), Ordering::Greater);
|
||||
assert_eq!(CookieStorage::cookie_comparator(&a, &a), Ordering::Equal);
|
||||
}
|
||||
|
||||
fn add_cookie_to_storage(storage: &mut CookieStorage, url: &ServoUrl, cookie_str: &str)
|
||||
|
|
|
@ -74,7 +74,7 @@ fn test_fetch_on_bad_port_is_network_error() {
|
|||
let fetch_response = fetch(&mut request, None);
|
||||
assert!(fetch_response.is_network_error());
|
||||
let fetch_error = fetch_response.get_network_error().unwrap();
|
||||
assert!(fetch_error == &NetworkError::Internal("Request attempted on bad port".into()))
|
||||
assert_eq!(fetch_error, &NetworkError::Internal("Request attempted on bad port".into()))
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -110,7 +110,7 @@ fn test_fetch_aboutblank() {
|
|||
request.referrer = Referrer::NoReferrer;
|
||||
let fetch_response = fetch(&mut request, None);
|
||||
assert!(!fetch_response.is_network_error());
|
||||
assert!(*fetch_response.body.lock().unwrap() == ResponseBody::Done(vec![]));
|
||||
assert_eq!(*fetch_response.body.lock().unwrap(), ResponseBody::Done(vec![]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -166,7 +166,7 @@ fn test_fetch_file() {
|
|||
assert!(!fetch_response.is_network_error());
|
||||
assert_eq!(fetch_response.headers.len(), 1);
|
||||
let content_type: &ContentType = fetch_response.headers.get().unwrap();
|
||||
assert!(**content_type == Mime(TopLevel::Text, SubLevel::Css, vec![]));
|
||||
assert_eq!(**content_type, Mime(TopLevel::Text, SubLevel::Css, vec![]));
|
||||
|
||||
let resp_body = fetch_response.body.lock().unwrap();
|
||||
let mut file = File::open(path).unwrap();
|
||||
|
|
|
@ -92,7 +92,7 @@ fn test_push_entry_with_0_max_age_evicts_entry_from_list() {
|
|||
list.push(HstsEntry::new("mozilla.org".to_owned(),
|
||||
IncludeSubdomains::NotIncluded, Some(0)).unwrap());
|
||||
|
||||
assert!(list.is_host_secure("mozilla.org") == false)
|
||||
assert_eq!(list.is_host_secure("mozilla.org"), false)
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -107,7 +107,7 @@ fn test_push_entry_to_hsts_list_should_not_add_subdomains_whose_superdomain_is_a
|
|||
list.push(HstsEntry::new("servo.mozilla.org".to_owned(),
|
||||
IncludeSubdomains::NotIncluded, None).unwrap());
|
||||
|
||||
assert!(list.entries_map.get("mozilla.org").unwrap().len() == 1)
|
||||
assert_eq!(list.entries_map.get("mozilla.org").unwrap().len(), 1)
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -139,7 +139,7 @@ fn test_push_entry_to_hsts_list_should_not_create_duplicate_entry() {
|
|||
list.push(HstsEntry::new("mozilla.org".to_owned(),
|
||||
IncludeSubdomains::NotIncluded, None).unwrap());
|
||||
|
||||
assert!(list.entries_map.get("mozilla.org").unwrap().len() == 1)
|
||||
assert_eq!(list.entries_map.get("mozilla.org").unwrap().len(), 1)
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -116,6 +116,6 @@ fn test_reg_suffix() {
|
|||
#[test]
|
||||
fn test_weirdness() {
|
||||
// These are weird results, but AFAICT they are spec-compliant.
|
||||
assert!(pub_suffix("city.yokohama.jp") != pub_suffix(pub_suffix("city.yokohama.jp")));
|
||||
assert_ne!(pub_suffix("city.yokohama.jp"), pub_suffix(pub_suffix("city.yokohama.jp")));
|
||||
assert!(!is_pub_domain(pub_suffix("city.yokohama.jp")));
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ impl Attr {
|
|||
ScriptThread::enqueue_callback_reaction(owner, reaction, None);
|
||||
}
|
||||
|
||||
assert!(Some(owner) == self.owner().r());
|
||||
assert_eq!(Some(owner), self.owner().r());
|
||||
owner.will_mutate_attr(self);
|
||||
self.swap_value(&mut value);
|
||||
if self.identifier.namespace == ns!() {
|
||||
|
@ -230,7 +230,7 @@ impl Attr {
|
|||
// Already gone from the list of attributes of old owner.
|
||||
assert!(old.get_attribute(&ns, &self.identifier.local_name).r() != Some(self))
|
||||
}
|
||||
(Some(old), Some(new)) => assert!(&*old == new),
|
||||
(Some(old), Some(new)) => assert_eq!(&*old, new),
|
||||
_ => {},
|
||||
}
|
||||
self.owner.set(owner);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ fn create_svg_element(name: QualName,
|
|||
prefix: Option<Prefix>,
|
||||
document: &Document)
|
||||
-> DomRoot<Element> {
|
||||
assert!(name.ns == ns!(svg));
|
||||
assert_eq!(name.ns, ns!(svg));
|
||||
|
||||
macro_rules! make(
|
||||
($ctor:ident) => ({
|
||||
|
@ -119,7 +119,7 @@ fn create_html_element(name: QualName,
|
|||
creator: ElementCreator,
|
||||
mode: CustomElementCreationMode)
|
||||
-> DomRoot<Element> {
|
||||
assert!(name.ns == ns!(html));
|
||||
assert_eq!(name.ns, ns!(html));
|
||||
|
||||
// Step 4
|
||||
let definition = document.lookup_custom_element_definition(&name.ns, &name.local, is.as_ref());
|
||||
|
|
|
@ -1831,8 +1831,8 @@ impl Document {
|
|||
return;
|
||||
}
|
||||
self.domcontentloaded_dispatched.set(true);
|
||||
assert!(self.ReadyState() != DocumentReadyState::Complete,
|
||||
"Complete before DOMContentLoaded?");
|
||||
assert_ne!(self.ReadyState(), DocumentReadyState::Complete,
|
||||
"Complete before DOMContentLoaded?");
|
||||
|
||||
update_with_current_time_ms(&self.dom_content_loaded_event_start);
|
||||
|
||||
|
|
|
@ -610,6 +610,6 @@ fn timestamp_in_ms(time: Timespec) -> u64 {
|
|||
unsafe fn global_scope_from_global(global: *mut JSObject) -> DomRoot<GlobalScope> {
|
||||
assert!(!global.is_null());
|
||||
let clasp = get_object_class(global);
|
||||
assert!(((*clasp).flags & (JSCLASS_IS_DOMJSCLASS | JSCLASS_IS_GLOBAL)) != 0);
|
||||
assert_ne!(((*clasp).flags & (JSCLASS_IS_DOMJSCLASS | JSCLASS_IS_GLOBAL)), 0);
|
||||
root_from_object(global).unwrap()
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ impl OptionU32 {
|
|||
}
|
||||
|
||||
fn some(bits: u32) -> OptionU32 {
|
||||
assert!(bits != u32::max_value());
|
||||
assert_ne!(bits, u32::max_value());
|
||||
OptionU32 { bits: bits }
|
||||
}
|
||||
|
||||
|
|
|
@ -416,7 +416,7 @@ impl Tokenizer {
|
|||
control.set_form_owner_from_parser(&form);
|
||||
} else {
|
||||
// TODO remove this code when keygen is implemented.
|
||||
assert!(node.NodeName() == "KEYGEN", "Unknown form-associatable element");
|
||||
assert_eq!(node.NodeName(), "KEYGEN", "Unknown form-associatable element");
|
||||
}
|
||||
}
|
||||
ParseOperation::Pop { node } => {
|
||||
|
|
|
@ -872,7 +872,7 @@ impl TreeSink for Sink {
|
|||
control.set_form_owner_from_parser(&form);
|
||||
} else {
|
||||
// TODO remove this code when keygen is implemented.
|
||||
assert!(node.NodeName() == "KEYGEN", "Unknown form-associatable element");
|
||||
assert_eq!(node.NodeName(), "KEYGEN", "Unknown form-associatable element");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ impl WebGLShader {
|
|||
|
||||
impl Drop for WebGLShader {
|
||||
fn drop(&mut self) {
|
||||
assert!(self.attached_counter.get() == 0);
|
||||
assert_eq!(self.attached_counter.get(), 0);
|
||||
self.delete();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ impl WindowProxy {
|
|||
let cx = window.get_cx();
|
||||
let window_jsobject = window.reflector().get_jsobject();
|
||||
assert!(!window_jsobject.get().is_null());
|
||||
assert!(((*get_object_class(window_jsobject.get())).flags & JSCLASS_IS_GLOBAL) != 0);
|
||||
assert_ne!(((*get_object_class(window_jsobject.get())).flags & JSCLASS_IS_GLOBAL), 0);
|
||||
let _ac = JSAutoCompartment::new(cx, window_jsobject.get());
|
||||
|
||||
// Create a new window proxy.
|
||||
|
@ -163,7 +163,7 @@ impl WindowProxy {
|
|||
let window = DissimilarOriginWindow::new(global_to_clone_from, &*window_proxy);
|
||||
let window_jsobject = window.reflector().get_jsobject();
|
||||
assert!(!window_jsobject.get().is_null());
|
||||
assert!(((*get_object_class(window_jsobject.get())).flags & JSCLASS_IS_GLOBAL) != 0);
|
||||
assert_ne!(((*get_object_class(window_jsobject.get())).flags & JSCLASS_IS_GLOBAL), 0);
|
||||
let _ac = JSAutoCompartment::new(cx, window_jsobject.get());
|
||||
|
||||
// Create a new window proxy.
|
||||
|
@ -230,7 +230,7 @@ impl WindowProxy {
|
|||
let window_jsobject = window.reflector().get_jsobject();
|
||||
let old_js_proxy = self.reflector.get_jsobject();
|
||||
assert!(!window_jsobject.get().is_null());
|
||||
assert!(((*get_object_class(window_jsobject.get())).flags & JSCLASS_IS_GLOBAL) != 0);
|
||||
assert_ne!(((*get_object_class(window_jsobject.get())).flags & JSCLASS_IS_GLOBAL), 0);
|
||||
let _ac = JSAutoCompartment::new(cx, window_jsobject.get());
|
||||
|
||||
// The old window proxy no longer owns this browsing context.
|
||||
|
|
|
@ -75,7 +75,7 @@ use time;
|
|||
use timers::{OneshotTimerCallback, OneshotTimerHandle};
|
||||
use url::Position;
|
||||
|
||||
#[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
enum XMLHttpRequestState {
|
||||
Unsent = 0,
|
||||
Opened = 1,
|
||||
|
@ -849,7 +849,7 @@ pub type TrustedXHRAddress = Trusted<XMLHttpRequest>;
|
|||
|
||||
impl XMLHttpRequest {
|
||||
fn change_ready_state(&self, rs: XMLHttpRequestState) {
|
||||
assert!(self.ready_state.get() != rs);
|
||||
assert_ne!(self.ready_state.get(), rs);
|
||||
self.ready_state.set(rs);
|
||||
let event = Event::new(&self.global(),
|
||||
atom!("readystatechange"),
|
||||
|
@ -1205,7 +1205,7 @@ impl XMLHttpRequest {
|
|||
};
|
||||
let last = true;
|
||||
let (_, read, written, _) = decoder.decode_to_utf16(bytes, extra, last);
|
||||
assert!(read == bytes.len());
|
||||
assert_eq!(read, bytes.len());
|
||||
unsafe {
|
||||
utf16.set_len(written)
|
||||
}
|
||||
|
|
|
@ -529,7 +529,7 @@ impl<H, T> Arc<HeaderSlice<H, [T]>> {
|
|||
where I: Iterator<Item=T> + ExactSizeIterator
|
||||
{
|
||||
use ::std::mem::size_of;
|
||||
assert!(size_of::<T>() != 0, "Need to think about ZST");
|
||||
assert_ne!(size_of::<T>(), 0, "Need to think about ZST");
|
||||
|
||||
// Compute the required size for the allocation.
|
||||
let num_items = items.len();
|
||||
|
@ -718,7 +718,7 @@ impl<H: 'static, T: 'static> Arc<HeaderSliceWithLength<H, [T]>> {
|
|||
/// is not modified.
|
||||
#[inline]
|
||||
pub fn into_thin(a: Self) -> ThinArc<H, T> {
|
||||
assert!(a.header.length == a.slice.len(),
|
||||
assert_eq!(a.header.length, a.slice.len(),
|
||||
"Length needs to be correct for ThinArc to work");
|
||||
let fat_ptr: *mut ArcInner<HeaderSliceWithLength<H, [T]>> = a.ptr();
|
||||
mem::forget(a);
|
||||
|
@ -987,6 +987,6 @@ mod tests {
|
|||
let _ = x == x;
|
||||
Arc::from_thin(x.clone());
|
||||
}
|
||||
assert!(canary.load(Acquire) == 1);
|
||||
assert_eq!(canary.load(Acquire), 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -265,12 +265,12 @@ impl DebugWritingMode {
|
|||
impl DebugWritingMode {
|
||||
#[inline]
|
||||
fn check(&self, other: WritingMode) {
|
||||
assert!(self.mode == other)
|
||||
assert_eq!(self.mode, other)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn check_debug(&self, other: DebugWritingMode) {
|
||||
assert!(self.mode == other.mode)
|
||||
assert_eq!(self.mode, other.mode)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -230,7 +230,7 @@ impl ToComputedValue for TextOverflow {
|
|||
#[inline]
|
||||
fn from_computed_value(computed: &Self::ComputedValue) -> Self {
|
||||
if computed.sides_are_logical {
|
||||
assert!(computed.first == TextOverflowSide::Clip);
|
||||
assert_eq!(computed.first, TextOverflowSide::Clip);
|
||||
TextOverflow {
|
||||
first: computed.second.clone(),
|
||||
second: None,
|
||||
|
|
|
@ -832,7 +832,7 @@ impl Handler {
|
|||
};
|
||||
|
||||
// The compositor always sends RGB pixels.
|
||||
assert!(img.format == PixelFormat::RGB8, "Unexpected screenshot pixel format");
|
||||
assert_eq!(img.format, PixelFormat::RGB8, "Unexpected screenshot pixel format");
|
||||
let rgb = RgbImage::from_raw(img.width, img.height, img.bytes.to_vec()).unwrap();
|
||||
|
||||
let mut png_data = Vec::new();
|
||||
|
|
|
@ -564,7 +564,7 @@ pub fn app_wakeup() {
|
|||
#[cfg(target_os="linux")]
|
||||
pub fn init_window() {
|
||||
unsafe {
|
||||
assert!(XInitThreads() != 0);
|
||||
assert_ne!(XInitThreads(), 0);
|
||||
DISPLAY = XOpenDisplay(ptr::null()) as *mut c_void;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ impl HeadlessContext {
|
|||
gl::UNSIGNED_BYTE,
|
||||
width as i32,
|
||||
height as i32);
|
||||
assert!(ret != 0);
|
||||
assert_ne!(ret, 0);
|
||||
};
|
||||
|
||||
HeadlessContext {
|
||||
|
|
|
@ -29,9 +29,9 @@ fn test_size_round_trip() {
|
|||
let physical = Size2D::new(1u32, 2u32);
|
||||
for &mode in modes().iter() {
|
||||
let logical = LogicalSize::from_physical(mode, physical);
|
||||
assert!(logical.to_physical(mode) == physical);
|
||||
assert!(logical.width(mode) == 1);
|
||||
assert!(logical.height(mode) == 2);
|
||||
assert_eq!(logical.to_physical(mode), physical);
|
||||
assert_eq!(logical.width(mode), 1);
|
||||
assert_eq!(logical.height(mode), 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,9 +41,9 @@ fn test_point_round_trip() {
|
|||
let container = Size2D::new(100, 200);
|
||||
for &mode in modes().iter() {
|
||||
let logical = LogicalPoint::from_physical(mode, physical, container);
|
||||
assert!(logical.to_physical(mode, container) == physical);
|
||||
assert!(logical.x(mode, container) == 1);
|
||||
assert!(logical.y(mode, container) == 2);
|
||||
assert_eq!(logical.to_physical(mode, container), physical);
|
||||
assert_eq!(logical.x(mode, container), 1);
|
||||
assert_eq!(logical.y(mode, container), 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,11 +52,11 @@ fn test_margin_round_trip() {
|
|||
let physical = SideOffsets2D::new(1u32, 2u32, 3u32, 4u32);
|
||||
for &mode in modes().iter() {
|
||||
let logical = LogicalMargin::from_physical(mode, physical);
|
||||
assert!(logical.to_physical(mode) == physical);
|
||||
assert!(logical.top(mode) == 1);
|
||||
assert!(logical.right(mode) == 2);
|
||||
assert!(logical.bottom(mode) == 3);
|
||||
assert!(logical.left(mode) == 4);
|
||||
assert_eq!(logical.to_physical(mode), physical);
|
||||
assert_eq!(logical.top(mode), 1);
|
||||
assert_eq!(logical.right(mode), 2);
|
||||
assert_eq!(logical.bottom(mode), 3);
|
||||
assert_eq!(logical.left(mode), 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,6 +66,6 @@ fn test_rect_round_trip() {
|
|||
let container = Size2D::new(100, 200);
|
||||
for &mode in modes().iter() {
|
||||
let logical = LogicalRect::from_physical(mode, physical, container);
|
||||
assert!(logical.to_physical(mode, container) == physical);
|
||||
assert_eq!(logical.to_physical(mode, container), physical);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,12 +75,12 @@ fn test_meta_viewport<F>(meta: &str, callback: F)
|
|||
|
||||
macro_rules! assert_decl_len {
|
||||
($declarations:ident == 1) => {
|
||||
assert!($declarations.len() == 1,
|
||||
assert_eq!($declarations.len(), 1,
|
||||
"expected 1 declaration; have {}: {:?})",
|
||||
$declarations.len(), $declarations)
|
||||
};
|
||||
($declarations:ident == $len:expr) => {
|
||||
assert!($declarations.len() == $len,
|
||||
assert_eq!($declarations.len(), $len,
|
||||
"expected {} declarations; have {}: {:?})",
|
||||
$len, $declarations.len(), $declarations)
|
||||
}
|
||||
|
@ -109,12 +109,12 @@ macro_rules! assert_decl_eq {
|
|||
($d:expr, $origin:ident, $expected:ident: $value:expr) => {{
|
||||
assert_eq!($d.origin, Origin::$origin);
|
||||
assert_eq!($d.descriptor, ViewportDescriptor::$expected($value));
|
||||
assert!($d.important == false, "descriptor should not be !important");
|
||||
assert_eq!($d.important, false, "descriptor should not be !important");
|
||||
}};
|
||||
($d:expr, $origin:ident, $expected:ident: $value:expr, !important) => {{
|
||||
assert_eq!($d.origin, Origin::$origin);
|
||||
assert_eq!($d.descriptor, ViewportDescriptor::$expected($value));
|
||||
assert!($d.important == true, "descriptor should be !important");
|
||||
assert_eq!($d.important, true, "descriptor should be !important");
|
||||
}};
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче