@@ -845,7 +845,6 @@ impl From<&proto::Expr> for Expr {
845
845
// PANIC SAFETY: experimental feature
846
846
#[ allow( clippy:: expect_used) ]
847
847
fn from ( v : & proto:: Expr ) -> Self {
848
- let source_loc: Option < Loc > = v. source_loc . as_ref ( ) . map ( Loc :: from) ;
849
848
let pdata = v
850
849
. expr_kind
851
850
. as_ref ( )
@@ -857,19 +856,19 @@ impl From<&proto::Expr> for Expr {
857
856
858
857
match ety {
859
858
proto:: expr:: expr_kind:: Data :: Lit ( lit) => {
860
- Expr :: val ( Literal :: from ( lit) ) . with_maybe_source_loc ( source_loc )
859
+ Expr :: val ( Literal :: from ( lit) )
861
860
}
862
861
863
862
proto:: expr:: expr_kind:: Data :: Var ( var) => {
864
863
let pvar =
865
864
proto:: expr:: Var :: try_from ( var. to_owned ( ) ) . expect ( "decode should succeed" ) ;
866
- Expr :: var ( Var :: from ( & pvar) ) . with_maybe_source_loc ( source_loc )
865
+ Expr :: var ( Var :: from ( & pvar) )
867
866
}
868
867
869
868
proto:: expr:: expr_kind:: Data :: Slot ( slot) => {
870
869
let pslot =
871
870
proto:: SlotId :: try_from ( slot. to_owned ( ) ) . expect ( "decode should succeed" ) ;
872
- Expr :: slot ( SlotId :: from ( & pslot) ) . with_maybe_source_loc ( source_loc )
871
+ Expr :: slot ( SlotId :: from ( & pslot) )
873
872
}
874
873
875
874
proto:: expr:: expr_kind:: Data :: If ( msg) => {
@@ -893,7 +892,6 @@ impl From<&proto::Expr> for Expr {
893
892
Expr :: from ( then_expr) ,
894
893
Expr :: from ( else_expr) ,
895
894
)
896
- . with_maybe_source_loc ( source_loc)
897
895
}
898
896
899
897
proto:: expr:: expr_kind:: Data :: And ( msg) => {
@@ -907,7 +905,7 @@ impl From<&proto::Expr> for Expr {
907
905
. as_ref ( )
908
906
. expect ( "`as_ref()` for field that should exist" )
909
907
. as_ref ( ) ;
910
- Expr :: and ( Expr :: from ( left) , Expr :: from ( right) ) . with_maybe_source_loc ( source_loc )
908
+ Expr :: and ( Expr :: from ( left) , Expr :: from ( right) )
911
909
}
912
910
913
911
proto:: expr:: expr_kind:: Data :: Or ( msg) => {
@@ -921,7 +919,7 @@ impl From<&proto::Expr> for Expr {
921
919
. as_ref ( )
922
920
. expect ( "`as_ref()` for field that should exist" )
923
921
. as_ref ( ) ;
924
- Expr :: or ( Expr :: from ( left) , Expr :: from ( right) ) . with_maybe_source_loc ( source_loc )
922
+ Expr :: or ( Expr :: from ( left) , Expr :: from ( right) )
925
923
}
926
924
927
925
proto:: expr:: expr_kind:: Data :: UApp ( msg) => {
@@ -933,7 +931,6 @@ impl From<&proto::Expr> for Expr {
933
931
let puop =
934
932
proto:: expr:: unary_app:: Op :: try_from ( msg. op ) . expect ( "decode should succeed" ) ;
935
933
Expr :: unary_app ( UnaryOp :: from ( & puop) , Expr :: from ( arg) )
936
- . with_maybe_source_loc ( source_loc)
937
934
}
938
935
939
936
proto:: expr:: expr_kind:: Data :: BApp ( msg) => {
@@ -952,7 +949,6 @@ impl From<&proto::Expr> for Expr {
952
949
Expr :: from ( left. as_ref ( ) ) ,
953
950
Expr :: from ( right. as_ref ( ) ) ,
954
951
)
955
- . with_maybe_source_loc ( source_loc)
956
952
}
957
953
958
954
proto:: expr:: expr_kind:: Data :: ExtApp ( msg) => Expr :: call_extension_fn (
@@ -962,8 +958,7 @@ impl From<&proto::Expr> for Expr {
962
958
. expect ( "`as_ref()` for field that should exist" ) ,
963
959
) ,
964
960
msg. args . iter ( ) . map ( Expr :: from) . collect ( ) ,
965
- )
966
- . with_maybe_source_loc ( source_loc) ,
961
+ ) ,
967
962
968
963
proto:: expr:: expr_kind:: Data :: GetAttr ( msg) => {
969
964
let arg = msg
@@ -972,7 +967,6 @@ impl From<&proto::Expr> for Expr {
972
967
. expect ( "`as_ref()` for field that should exist" )
973
968
. as_ref ( ) ;
974
969
Expr :: get_attr ( Expr :: from ( arg) , msg. attr . clone ( ) . into ( ) )
975
- . with_maybe_source_loc ( source_loc)
976
970
}
977
971
978
972
proto:: expr:: expr_kind:: Data :: HasAttr ( msg) => {
@@ -982,7 +976,6 @@ impl From<&proto::Expr> for Expr {
982
976
. expect ( "`as_ref()` for field that should exist" )
983
977
. as_ref ( ) ;
984
978
Expr :: has_attr ( Expr :: from ( arg) , msg. attr . clone ( ) . into ( ) )
985
- . with_maybe_source_loc ( source_loc)
986
979
}
987
980
988
981
proto:: expr:: expr_kind:: Data :: Like ( msg) => {
@@ -995,7 +988,6 @@ impl From<&proto::Expr> for Expr {
995
988
Expr :: from ( arg) ,
996
989
msg. pattern . iter ( ) . map ( PatternElem :: from) . collect ( ) ,
997
990
)
998
- . with_maybe_source_loc ( source_loc)
999
991
}
1000
992
1001
993
proto:: expr:: expr_kind:: Data :: Is ( msg) => {
@@ -1012,20 +1004,18 @@ impl From<&proto::Expr> for Expr {
1012
1004
. expect ( "`as_ref()` for field that should exist" ) ,
1013
1005
) ,
1014
1006
)
1015
- . with_maybe_source_loc ( source_loc)
1016
1007
}
1017
1008
1018
1009
proto:: expr:: expr_kind:: Data :: Set ( msg) => {
1019
- Expr :: set ( msg. elements . iter ( ) . map ( Expr :: from) ) . with_maybe_source_loc ( source_loc )
1010
+ Expr :: set ( msg. elements . iter ( ) . map ( Expr :: from) )
1020
1011
}
1021
1012
1022
1013
proto:: expr:: expr_kind:: Data :: Record ( msg) => Expr :: record (
1023
1014
msg. items
1024
1015
. iter ( )
1025
1016
. map ( |( key, value) | ( key. into ( ) , Expr :: from ( value) ) ) ,
1026
1017
)
1027
- . expect ( "Expr should be valid" )
1028
- . with_maybe_source_loc ( source_loc) ,
1018
+ . expect ( "Expr should be valid" ) ,
1029
1019
}
1030
1020
}
1031
1021
}
@@ -1035,7 +1025,6 @@ impl From<&Expr> for proto::Expr {
1035
1025
// PANIC SAFETY: experimental feature
1036
1026
#[ allow( clippy:: unimplemented) ]
1037
1027
fn from ( v : & Expr ) -> Self {
1038
- let source_loc: Option < proto:: Loc > = v. source_loc . as_ref ( ) . map ( proto:: Loc :: from) ;
1039
1028
let expr_kind = match & v. expr_kind {
1040
1029
ExprKind :: Lit ( l) => proto:: expr:: expr_kind:: Data :: Lit ( proto:: expr:: Literal :: from ( l) ) ,
1041
1030
ExprKind :: Var ( v) => proto:: expr:: expr_kind:: Data :: Var ( proto:: expr:: Var :: from ( v) . into ( ) ) ,
@@ -1139,7 +1128,6 @@ impl From<&Expr> for proto::Expr {
1139
1128
expr_kind : Some ( Box :: new ( proto:: expr:: ExprKind {
1140
1129
data : Some ( expr_kind) ,
1141
1130
} ) ) ,
1142
- source_loc,
1143
1131
}
1144
1132
}
1145
1133
}
0 commit comments