Skip to content
This repository was archived by the owner on Jul 27, 2023. It is now read-only.

Commit a0fb011

Browse files
konstinzanieb
authored andcommitted
impl<T> Ranged for &T where T: Ranged (#16)
In the example below, `arg` is `&Expr`, so `&Ranged`, but `entries()` want a `T: Ranged`. This adds the missing bridge impl. ```rust let all_args = format_with(|f| { f.join_comma_separated() .entries( // We have the parentheses from the call so the arguments never need any args.iter() .map(|arg| (arg, arg.format().with_options(Parenthesize::Never))), ) .nodes(keywords.iter()) .finish() }); ```
1 parent 2b3f717 commit a0fb011

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ast/src/ranged.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,13 @@ pub trait Ranged {
1414
}
1515
}
1616

17+
impl<T> Ranged for &T
18+
where
19+
T: Ranged,
20+
{
21+
fn range(&self) -> TextRange {
22+
T::range(self)
23+
}
24+
}
25+
1726
include!("gen/ranged.rs");

0 commit comments

Comments
 (0)