From e9f5382757866871ef3a79330fda8e33637ca811 Mon Sep 17 00:00:00 2001 From: Seiichi Uchida Date: Wed, 7 Mar 2018 15:53:17 +0900 Subject: [PATCH] Add a test for #2510 Closes #2510. --- tests/lib.rs | 10 ++++++---- tests/source/type.rs | 15 +++++++++++++++ tests/target/type.rs | 13 +++++++++++++ 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/tests/lib.rs b/tests/lib.rs index 9abe08ba9e0..4ec2c33a31a 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -330,26 +330,28 @@ fn check_files(files: Vec) -> (Vec, u32, u32) { } fn print_mismatches_default_message(result: HashMap>) { - let mut t = term::stdout().unwrap(); for (file_name, diff) in result { let mismatch_msg_formatter = |line_num| format!("\nMismatch at {}:{}:", file_name.display(), line_num); print_diff(diff, &mismatch_msg_formatter, Color::Auto); } - t.reset().unwrap(); + if let Some(mut t) = term::stdout() { + t.reset().unwrap_or(()); + } } fn print_mismatches String>( result: HashMap>, mismatch_msg_formatter: T, ) { - let mut t = term::stdout().unwrap(); for (_file_name, diff) in result { print_diff(diff, &mismatch_msg_formatter, Color::Auto); } - t.reset().unwrap(); + if let Some(mut t) = term::stdout() { + t.reset().unwrap_or(()); + } } fn read_config(filename: &Path) -> Config { diff --git a/tests/source/type.rs b/tests/source/type.rs index 0a46ffb2ee4..9477af52443 100644 --- a/tests/source/type.rs +++ b/tests/source/type.rs @@ -23,3 +23,18 @@ fn impl_trait_fn_2() -> impl Future {} fn issue_1234() { do_parse!(name: take_while1!(is_token) >> (Header)) } + +// #2510 +impl CombineTypes { + pub fn pop_callback( + &self, + query_id: Uuid, + ) -> Option< + ( + ProjectId, + Box () + Sync + Send>, + ), + > { + self.query_callbacks()(&query_id) + } +} diff --git a/tests/target/type.rs b/tests/target/type.rs index 2f35e796512..95f7ff3d5d2 100644 --- a/tests/target/type.rs +++ b/tests/target/type.rs @@ -29,3 +29,16 @@ fn impl_trait_fn_2() -> impl Future {} fn issue_1234() { do_parse!(name: take_while1!(is_token) >> (Header)) } + +// #2510 +impl CombineTypes { + pub fn pop_callback( + &self, + query_id: Uuid, + ) -> Option<( + ProjectId, + Box () + Sync + Send>, + )> { + self.query_callbacks()(&query_id) + } +} -- 2.44.0