Merge pull request #132 from liskin/stable-rust

fix build with stable rust
This commit is contained in:
phiresky 2022-06-12 11:00:41 +02:00 committed by GitHub
commit db32d8a736
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 10 deletions

View File

@ -22,14 +22,15 @@ jobs:
strategy: strategy:
matrix: matrix:
build: build:
- stable
- nightly - nightly
- nightly-musl - nightly-musl
- nightly-arm - nightly-arm
- macos - macos
include: include:
#- build: stable - build: stable
# os: ubuntu-18.04 os: ubuntu-18.04
# rust: stable rust: stable
- build: nightly - build: nightly
os: ubuntu-18.04 os: ubuntu-18.04
rust: nightly rust: nightly

View File

@ -158,7 +158,10 @@ impl Read for ReadErr {
} }
}*/ }*/
pub fn postproc_encoding<'a, R: Read+'a>(line_prefix: &str, inp: R) -> Result<Box<dyn Read + 'a>> { pub fn postproc_encoding<'a, R: Read + 'a>(
line_prefix: &str,
inp: R,
) -> Result<Box<dyn Read + 'a>> {
// TODO: parse these options from ripgrep's configuration // TODO: parse these options from ripgrep's configuration
let encoding = None; // detect bom but usually assume utf8 let encoding = None; // detect bom but usually assume utf8
let bom_sniffing = true; let bom_sniffing = true;
@ -184,9 +187,7 @@ pub fn postproc_encoding<'a, R: Read+'a>(line_prefix: &str, inp: R) -> Result<Bo
if fourk.contains(&0u8) { if fourk.contains(&0u8) {
log::debug!("detected binary"); log::debug!("detected binary");
let v = "[rga: binary data]"; let v = "[rga: binary data]";
return Ok(Box::new(std::io::Cursor::new( return Ok(Box::new(std::io::Cursor::new(v)));
v
)));
/*let err = std::io::Error::new( /*let err = std::io::Error::new(
std::io::ErrorKind::InvalidData, std::io::ErrorKind::InvalidData,
format!("{}[rga: binary data]", line_prefix), format!("{}[rga: binary data]", line_prefix),
@ -280,7 +281,12 @@ mod tests {
test_from_strs(false, "foo.pdf:", inp, oup)?; test_from_strs(false, "foo.pdf:", inp, oup)?;
test_from_strs(false, "foo:", "this is a test \n\n \0 foo", "foo:[rga: binary data]")?; test_from_strs(
false,
"foo:",
"this is a test \n\n \0 foo",
"foo:[rga: binary data]",
)?;
test_from_strs(false, "foo:", "\0", "foo:[rga: binary data]")?; test_from_strs(false, "foo:", "\0", "foo:[rga: binary data]")?;
Ok(()) Ok(())

View File

@ -1,5 +1,4 @@
#![warn(clippy::all)] #![warn(clippy::all)]
#![feature(negative_impls)]
pub mod adapted_iter; pub mod adapted_iter;
pub mod adapters; pub mod adapters;

View File

@ -21,7 +21,9 @@ pub trait PreprocCache: Send + Sync {
} }
/// opens a LMDB cache /// opens a LMDB cache
fn open_cache_db(path: &Path) -> Result<std::sync::Arc<std::sync::RwLock<rkv::Rkv<LmdbEnvironment>>>> { fn open_cache_db(
path: &Path,
) -> Result<std::sync::Arc<std::sync::RwLock<rkv::Rkv<LmdbEnvironment>>>> {
std::fs::create_dir_all(path)?; std::fs::create_dir_all(path)?;
use rkv::backend::LmdbEnvironmentFlags; use rkv::backend::LmdbEnvironmentFlags;