Skip to content
Myr

test_repr.rs

This file

Path

tests/test_repr.rs

30 lines · 614 bytes · Rust

Last changed by

Work around prelude redundant import warningsDavid Tolnaybefore adoptiondfc7bc0

History of this file

Take it

1#![allow(clippy::extra_unused_type_parameters)]23mod drop;45use self::drop::{DetectDrop, Flag};6use anyhow::Error;7use std::mem;89#[test]10fn test_error_size() {11    assert_eq!(mem::size_of::<Error>(), mem::size_of::<usize>());12}1314#[test]15fn test_null_pointer_optimization() {16    assert_eq!(mem::size_of::<Result<(), Error>>(), mem::size_of::<usize>());17}1819#[test]20fn test_autotraits() {21    fn assert<E: Unpin + Send + Sync + 'static>() {}22    assert::<Error>();23}2425#[test]26fn test_drop() {27    let has_dropped = Flag::new();28    drop(Error::new(DetectDrop::new(&has_dropped)));29    assert!(has_dropped.get());30}