Skip to content

Commit

Permalink
Extract where clause example so it'll get rustfmtted in the future
Browse files Browse the repository at this point in the history
  • Loading branch information
carols10cents committed Jul 5, 2022
1 parent d6efdcc commit 92bfbfa
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "chapter10"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// ANCHOR: here
fn some_function<T, U>(t: &T, u: &U) -> i32
where
T: Display + Clone,
U: Clone + Debug,
{
// ANCHOR_END: here
unimplemented!()
}
6 changes: 1 addition & 5 deletions src/ch10-02-traits.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,7 @@ fn some_function<T: Display + Clone, U: Clone + Debug>(t: &T, u: &U) -> i32 {
we can use a `where` clause, like this:

```rust,ignore
fn some_function<T, U>(t: &T, u: &U) -> i32
where
T: Display + Clone,
U: Clone + Debug,
{
{{#rustdoc_include ../listings/ch10-generic-types-traits-and-lifetimes/no-listing-07-where-clause/src/lib.rs:here}}
```

This function’s signature is less cluttered: the function name, parameter list,
Expand Down

0 comments on commit 92bfbfa

Please sign in to comment.