diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d7aacd71..f2ff95b8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,7 +63,10 @@ jobs: - name: Build Windows if: matrix.os == 'windows' env: - RUSTFLAGS: -Clto=fat -Cembed-bitcode=true -Clinker=lld-link + MOZ_LTO: full + CFLAGS: /clang:-flto + CPPFLAGS: " /clang:-flto" + RUSTFLAGS: -Clinker-plugin-lto -Clinker=lld-link run: | just build-release -v --target $env:TARGET Rename-Item -Path .\target\$env:TARGET\release\cli.exe -NewName spiderfire.exe @@ -78,8 +81,9 @@ jobs: if: matrix.os == 'linux' env: MOZ_LTO: full - CFLAGS: -flto -fuse-ld=lld - CXXFLAGS: -flto -fuse-ld=lld + CFLAGS: -flto + CPPFLAGS: -flto + CXXFLAGS: -flto LDFLAGS: -fuse-ld=lld RUSTFLAGS: -Clinker-plugin-lto -Clinker=clang -Clink-arg=-fuse-ld=lld run: | diff --git a/modules/src/fs/fs.rs b/modules/src/fs/fs.rs index 5f66da07..5ca32018 100644 --- a/modules/src/fs/fs.rs +++ b/modules/src/fs/fs.rs @@ -20,38 +20,38 @@ use runtime::promise::future_to_promise; fn check_exists(path: &Path) -> Result<()> { if path.exists() { + Ok(()) + } else { Err(Error::new( format!("Path {} does not exist", path.to_str().unwrap()), None, )) - } else { - Ok(()) } } fn check_not_exists(path: &Path) -> Result<()> { if !path.exists() { - Err(Error::new(format!("Path {} exist", path.to_str().unwrap()), None)) - } else { Ok(()) + } else { + Err(Error::new(format!("Path {} exists", path.to_str().unwrap()), None)) } } fn check_is_file(path: &Path) -> Result<()> { check_exists(path)?; if path.is_file() { + Ok(()) + } else { Err(Error::new( format!("Path {} is not a file", path.to_str().unwrap()), None, )) - } else { - Ok(()) } } fn check_is_not_file(path: &Path) -> Result<()> { check_exists(path)?; - if !path.is_file() { + if path.is_file() { Err(Error::new(format!("Path {} is a file", path.to_str().unwrap()), None)) } else { Ok(()) @@ -61,18 +61,18 @@ fn check_is_not_file(path: &Path) -> Result<()> { fn check_is_dir(path: &Path) -> Result<()> { check_exists(path)?; if path.is_dir() { + Ok(()) + } else { Err(Error::new( format!("Path {} is not a directory", path.to_str().unwrap()), None, )) - } else { - Ok(()) } } fn check_is_not_dir(path: &Path) -> Result<()> { check_exists(path)?; - if !path.is_dir() { + if path.is_dir() { Err(Error::new( format!("Path {} is a directory", path.to_str().unwrap()), None,