@@ -10,12 +10,11 @@ use crate::flatten::FlattenParser;
1010use crate :: many:: { ManyCombiner , ManyParser , VecManyCombiner } ;
1111use crate :: map:: { MapParser , MapToUnitParser } ;
1212use crate :: map_ctx:: MapCtxParser ;
13- use crate :: map_err:: {
14- ErrorMapper , FatalErrorOverrider , MapErrParser , SoftErrorOverrider , ToFatalErrorMapper
15- } ;
13+ use crate :: map_err:: { ErrorMapper , FatalErrorOverrider , MapErrParser , SoftErrorOverrider } ;
1614use crate :: no_context:: NoContextParser ;
1715use crate :: or_default:: OrDefaultParser ;
1816use crate :: peek:: PeekParser ;
17+ use crate :: to_fatal:: ToFatalParser ;
1918use crate :: to_option:: ToOptionParser ;
2019
2120/// A parser uses the given input in order to produce a result.
@@ -337,14 +336,6 @@ where
337336 self . map_err ( FatalErrorOverrider :: new ( err) )
338337 }
339338
340- /// If this parser returns a soft error, it will be converted to a fatal error.
341- fn to_fatal ( self ) -> MapErrParser < Self , ToFatalErrorMapper >
342- where
343- Self : Sized ,
344- {
345- self . map_err ( ToFatalErrorMapper )
346- }
347-
348339 // =======================================================================
349340 // NoContext
350341 // =======================================================================
@@ -413,6 +404,18 @@ where
413404 ThenWithContextParser :: new ( self , other, combiner)
414405 }
415406
407+ // =======================================================================
408+ // ToFatal
409+ // =======================================================================
410+
411+ /// If this parser returns a soft error, it will be converted to a fatal error.
412+ fn to_fatal ( self ) -> ToFatalParser < Self >
413+ where
414+ Self : Sized ,
415+ {
416+ ToFatalParser :: new ( self )
417+ }
418+
416419 // =======================================================================
417420 // ToOption
418421 // =======================================================================
0 commit comments