Skip to content

Commit

Permalink
Remove unnecessary debug_assert!s
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda committed Jun 7, 2023
1 parent 68481c2 commit 93b34d4
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/platform_impl/web/web_sys/resize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,16 @@ impl ResizeHandle {
canvas: &HtmlCanvasElement,
entries: Array,
) -> SizeChangeArgs {
debug_assert_eq!(entries.length(), 1, "expected exactly one entry");
let entry = entries.get(0);
debug_assert!(entry.has_type::<ResizeObserverEntry>());
let entry: ResizeObserverEntry = entry.unchecked_into();
let entry: ResizeObserverEntry = entries.get(0).unchecked_into();

let rect = entry.content_rect();
let content = PhysicalSize::new(rect.width().round() as u32, rect.height().round() as u32);

let pixel = has_device_pixel_support().then(|| {
let entries = entry.device_pixel_content_box_size();
debug_assert_eq!(
entries.length(),
1,
"a canvas can't be split into multiple fragments"
);
let entry = entries.get(0);
debug_assert!(entry.has_type::<ResizeObserverSize>());
let entry: ResizeObserverSize = entry.unchecked_into();
let entry: ResizeObserverSize = entry
.device_pixel_content_box_size()
.get(0)
.unchecked_into();

let style = window
.get_computed_style(canvas)
Expand Down

0 comments on commit 93b34d4

Please sign in to comment.