Skip to content
Myr

test_convert.rs

This file

Path

tests/test_convert.rs

46 lines · 1.1 KiB · Rust

Last changed by

Not known.

History of this file

Take it

The walk stopped after 200 commits: lines older than 553ed38 point at it.

Update clippy.toml msrv to match rust-version in Cargo.tomlDavid Tolnaybefore adoption553ed38

lines 1–46why, one step back
1#![allow(clippy::unnecessary_wraps)]
23mod drop;45use self::drop::{DetectDrop, Flag};6use anyhow::{Error, Result};7use std::error::Error as StdError;89#[test]10fn test_convert() {11 let has_dropped = Flag::new();12 let error = Error::new(DetectDrop::new(&has_dropped));13 let box_dyn = Box::<dyn StdError>::from(error);14 assert_eq!("oh no!", box_dyn.to_string());15 drop(box_dyn);16 assert!(has_dropped.get());17}1819#[test]20fn test_convert_send() {21 let has_dropped = Flag::new();22 let error = Error::new(DetectDrop::new(&has_dropped));23 let box_dyn = Box::<dyn StdError + Send>::from(error);24 assert_eq!("oh no!", box_dyn.to_string());25 drop(box_dyn);26 assert!(has_dropped.get());27}2829#[test]30fn test_convert_send_sync() {31 let has_dropped = Flag::new();32 let error = Error::new(DetectDrop::new(&has_dropped));33 let box_dyn = Box::<dyn StdError + Send + Sync>::from(error);34 assert_eq!("oh no!", box_dyn.to_string());35 drop(box_dyn);36 assert!(has_dropped.get());37}3839#[test]40fn test_question_mark() -> Result<(), Box<dyn StdError>> {41 fn f() -> Result<()> {42 Ok(())43 }44 f()?;45 Ok(())46}