diff --git a/flake.nix b/flake.nix index 54a080a..7dda473 100644 --- a/flake.nix +++ b/flake.nix @@ -96,12 +96,16 @@ // { buildInputs = []; nativeBuildInputs = []; - packages = with pkgs; [ - cargo-nextest - cargo-criterion - cargo-outdated - cargo-llvm-cov - ]; + packages = with pkgs; + [ + cargo-nextest + cargo-criterion + cargo-outdated + cargo-mutants + ] + ++ lib.optionals pkgs.stdenv.isLinux [ + cargo-llvm-cov + ]; }); } ); diff --git a/src/parser.rs b/src/parser.rs index a8713ba..467ca3f 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -163,12 +163,12 @@ fn span(last: Style) -> impl Fn(&[u8]) -> IResult<&[u8], Span<'static>, nom::err let (s, style) = opt(style(last))(s)?; #[cfg(feature = "simd")] - let (s, text) = map_res(take_while(|c| c != b'\x1b' | b'\n'), |t| { + let (s, text) = map_res(take_while(|c| c != b'\x1b' && c != b'\n'), |t| { simdutf8::basic::from_utf8(t) })(s)?; #[cfg(not(feature = "simd"))] - let (s, text) = map_res(take_while(|c| c != b'\x1b' | b'\n'), |t| { + let (s, text) = map_res(take_while(|c| c != b'\x1b' && c != b'\n'), |t| { std::str::from_utf8(t) })(s)?; @@ -187,12 +187,12 @@ fn span_fast(last: Style) -> impl Fn(&[u8]) -> IResult<&[u8], Span<'_>, nom::err let (s, style) = opt(style(last))(s)?; #[cfg(feature = "simd")] - let (s, text) = map_res(take_while(|c| c != b'\x1b' | b'\n'), |t| { + let (s, text) = map_res(take_while(|c| c != b'\x1b' && c != b'\n'), |t| { simdutf8::basic::from_utf8(t) })(s)?; #[cfg(not(feature = "simd"))] - let (s, text) = map_res(take_while(|c| c != b'\x1b' | b'\n'), |t| { + let (s, text) = map_res(take_while(|c| c != b'\x1b' && c != b'\n'), |t| { std::str::from_utf8(t) })(s)?; @@ -200,7 +200,7 @@ fn span_fast(last: Style) -> impl Fn(&[u8]) -> IResult<&[u8], Span<'_>, nom::err last = last.patch(style); } - Ok((s, Span::styled(text.to_owned(), last))) + Ok((s, Span::styled(text, last))) } }