@@ -209,7 +209,7 @@ a struct holding the matcher's data and have it implement the trait
209
209
[ ` Matcher ` ] :
210
210
211
211
``` no_run
212
- use googletest::matcher::{Matcher, MatcherResult};
212
+ use googletest::{description::Description, matcher::{Matcher, MatcherResult} };
213
213
use std::fmt::Debug;
214
214
215
215
struct MyEqMatcher<T> {
@@ -227,13 +227,13 @@ impl<T: PartialEq + Debug> Matcher for MyEqMatcher<T> {
227
227
}
228
228
}
229
229
230
- fn describe(&self, matcher_result: MatcherResult) -> String {
230
+ fn describe(&self, matcher_result: MatcherResult) -> Description {
231
231
match matcher_result {
232
232
MatcherResult::Match => {
233
- format!("is equal to {:?} the way I define it", self.expected)
233
+ format!("is equal to {:?} the way I define it", self.expected).into()
234
234
}
235
235
MatcherResult::NoMatch => {
236
- format!("isn't equal to {:?} the way I define it", self.expected)
236
+ format!("isn't equal to {:?} the way I define it", self.expected).into()
237
237
}
238
238
}
239
239
}
@@ -243,7 +243,7 @@ impl<T: PartialEq + Debug> Matcher for MyEqMatcher<T> {
243
243
It is recommended to expose a function which constructs the matcher:
244
244
245
245
``` no_run
246
- # use googletest::matcher::{Matcher, MatcherResult};
246
+ # use googletest::{description::Description, matcher::{Matcher, MatcherResult} };
247
247
# use std::fmt::Debug;
248
248
#
249
249
# struct MyEqMatcher<T> {
@@ -261,13 +261,13 @@ impl<T: PartialEq + Debug> Matcher for MyEqMatcher<T> {
261
261
# }
262
262
# }
263
263
#
264
- # fn describe(&self, matcher_result: MatcherResult) -> String {
264
+ # fn describe(&self, matcher_result: MatcherResult) -> Description {
265
265
# match matcher_result {
266
266
# MatcherResult::Match => {
267
- # format!("is equal to {:?} the way I define it", self.expected)
267
+ # format!("is equal to {:?} the way I define it", self.expected).into()
268
268
# }
269
269
# MatcherResult::NoMatch => {
270
- # format!("isn't equal to {:?} the way I define it", self.expected)
270
+ # format!("isn't equal to {:?} the way I define it", self.expected).into()
271
271
# }
272
272
# }
273
273
# }
@@ -282,7 +282,7 @@ impl<T: PartialEq + Debug> Matcher for MyEqMatcher<T> {
282
282
283
283
```
284
284
# use googletest::prelude::*;
285
- # use googletest::matcher::{Matcher, MatcherResult};
285
+ # use googletest::{description::Description, matcher::{Matcher, MatcherResult} };
286
286
# use std::fmt::Debug;
287
287
#
288
288
# struct MyEqMatcher<T> {
@@ -300,13 +300,13 @@ impl<T: PartialEq + Debug> Matcher for MyEqMatcher<T> {
300
300
# }
301
301
# }
302
302
#
303
- # fn describe(&self, matcher_result: MatcherResult) -> String {
303
+ # fn describe(&self, matcher_result: MatcherResult) -> Description {
304
304
# match matcher_result {
305
305
# MatcherResult::Match => {
306
- # format!("is equal to {:?} the way I define it", self.expected)
306
+ # format!("is equal to {:?} the way I define it", self.expected).into()
307
307
# }
308
308
# MatcherResult::NoMatch => {
309
- # format!("isn't equal to {:?} the way I define it", self.expected)
309
+ # format!("isn't equal to {:?} the way I define it", self.expected).into()
310
310
# }
311
311
# }
312
312
# }
0 commit comments