RustFmt and Docu

This commit is contained in:
PeterUlb 2020-09-27 01:23:37 +02:00
parent 3afe132088
commit 5acc78e9f7
2 changed files with 5 additions and 4 deletions

View File

@ -5,6 +5,7 @@
* Add `TrailingSlash::MergeOnly` behaviour to `NormalizePath`, which allow `NormalizePath` * Add `TrailingSlash::MergeOnly` behaviour to `NormalizePath`, which allow `NormalizePath`
to keep the trailing slash's existance as it is. [#1695] to keep the trailing slash's existance as it is. [#1695]
* Fix `ResourceMap` recursive references when printing/debugging. [#1708] * Fix `ResourceMap` recursive references when printing/debugging. [#1708]
* Remove bound `std::marker::Sized` from `web::Data` to support storing `Arc<dyn Trait>` via `web::Data::from` [#1710]
[#1708]: https://github.com/actix/actix-web/pull/1708 [#1708]: https://github.com/actix/actix-web/pull/1708

View File

@ -300,16 +300,16 @@ mod tests {
fn get_num(&self) -> i32; fn get_num(&self) -> i32;
} }
struct A {} struct A {}
impl TestTrait for A{ impl TestTrait for A {
fn get_num(&self) -> i32 { fn get_num(&self) -> i32 {
42 42
} }
} }
// This works when Sized is required // This works when Sized is required
let dyn_arc_box: Arc<Box<dyn TestTrait>> = Arc::new(Box::new(A{})); let dyn_arc_box: Arc<Box<dyn TestTrait>> = Arc::new(Box::new(A {}));
let data_arc_box = Data::from(dyn_arc_box); let data_arc_box = Data::from(dyn_arc_box);
// This works when Data Sized Bound is removed // This works when Data Sized Bound is removed
let dyn_arc: Arc<dyn TestTrait> = Arc::new(A{}); let dyn_arc: Arc<dyn TestTrait> = Arc::new(A {});
let data_arc = Data::from(dyn_arc); let data_arc = Data::from(dyn_arc);
assert_eq!(data_arc_box.get_num(), data_arc.get_num()) assert_eq!(data_arc_box.get_num(), data_arc.get_num())
} }