11use rusty_common:: { AtPos , Position , Positioned } ;
22
3- use crate :: core:: { Context , LintErrorPos } ;
3+ use crate :: core:: { LintErrorPos , LinterContext } ;
44
55/// Convert from the current type into the target type O.
66/// By default, O is the same as the current type.
77pub trait Convertible < O = Self > : Sized {
8- fn convert ( self , ctx : & mut Context ) -> Result < O , LintErrorPos > ;
8+ fn convert ( self , ctx : & mut LinterContext ) -> Result < O , LintErrorPos > ;
99}
1010
1111// Blanket implementation for Option
@@ -14,7 +14,7 @@ impl<T, O> Convertible<Option<O>> for Option<T>
1414where
1515 T : Convertible < O > ,
1616{
17- fn convert ( self , ctx : & mut Context ) -> Result < Option < O > , LintErrorPos > {
17+ fn convert ( self , ctx : & mut LinterContext ) -> Result < Option < O > , LintErrorPos > {
1818 match self {
1919 Some ( t) => t. convert ( ctx) . map ( Some ) ,
2020 None => Ok ( None ) ,
@@ -28,7 +28,7 @@ impl<T, O> Convertible<Vec<O>> for Vec<T>
2828where
2929 T : Convertible < O > ,
3030{
31- fn convert ( self , ctx : & mut Context ) -> Result < Vec < O > , LintErrorPos > {
31+ fn convert ( self , ctx : & mut LinterContext ) -> Result < Vec < O > , LintErrorPos > {
3232 self . into_iter ( ) . map ( |t| t. convert ( ctx) ) . collect ( )
3333 }
3434}
@@ -39,7 +39,7 @@ impl<T, O> Convertible<Positioned<O>> for Positioned<T>
3939where
4040 T : ConvertibleIn < Position , O > ,
4141{
42- fn convert ( self , ctx : & mut Context ) -> Result < Positioned < O > , LintErrorPos > {
42+ fn convert ( self , ctx : & mut LinterContext ) -> Result < Positioned < O > , LintErrorPos > {
4343 let Self {
4444 element : statement,
4545 pos,
5454/// using additional information in the value U.
5555/// By default, O is the same as the current type.
5656pub trait ConvertibleIn < U , O = Self > : Sized {
57- fn convert_in ( self , ctx : & mut Context , value : U ) -> Result < O , LintErrorPos > ;
57+ fn convert_in ( self , ctx : & mut LinterContext , value : U ) -> Result < O , LintErrorPos > ;
5858
59- fn convert_in_default ( self , ctx : & mut Context ) -> Result < O , LintErrorPos >
59+ fn convert_in_default ( self , ctx : & mut LinterContext ) -> Result < O , LintErrorPos >
6060 where
6161 U : Default ,
6262 {
@@ -70,7 +70,7 @@ impl<U, T, O> ConvertibleIn<U, Option<O>> for Option<T>
7070where
7171 T : ConvertibleIn < U , O > ,
7272{
73- fn convert_in ( self , ctx : & mut Context , extra : U ) -> Result < Option < O > , LintErrorPos > {
73+ fn convert_in ( self , ctx : & mut LinterContext , extra : U ) -> Result < Option < O > , LintErrorPos > {
7474 match self {
7575 Some ( t) => t. convert_in ( ctx, extra) . map ( Some ) ,
7676 None => Ok ( None ) ,
8585 T : ConvertibleIn < U , O > ,
8686 U : Clone ,
8787{
88- fn convert_in ( self , ctx : & mut Context , extra : U ) -> Result < Vec < O > , LintErrorPos > {
88+ fn convert_in ( self , ctx : & mut LinterContext , extra : U ) -> Result < Vec < O > , LintErrorPos > {
8989 self . into_iter ( )
9090 . map ( |t| t. convert_in ( ctx, extra. clone ( ) ) )
9191 . collect ( )
0 commit comments