mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-11-20 11:55:34 +00:00
fix: eliminate clippy warnings (#2036)
using clippy 0.1.91 (898aff704d 2025-08-14), but some warnings already
exist in the latest stable version
mostly about elided lifetime and if-chain
only remaining warnings:
```
warning: struct `HashRepr` is never constructed
--> crates\tinymist-query\src\tests.rs:462:12
|
462 | pub struct HashRepr<T>(pub T);
| ^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: a method with this name may be added to the standard library in the future
--> crates\tinymist\src\actor\editor.rs:103:30
|
103 | ... .map_or_default(|fid| unix_slash(fid.vpath().as_rooted_path()));
| ^^^^^^^^^^^^^^
|
= warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior!
= note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919>
= help: call with fully qualified syntax `typst::typst_utils::OptionExt::map_or_default(...)` to keep using the current method
= note: `#[warn(unstable_name_collisions)]` on by default
help: add `#![feature(result_option_map_or_default)]` to the crate attributes to enable `std::option::Option::<T>::map_or_default`
--> crates\tinymist\src\lib.rs:3:1
|
3 + #![feature(result_option_map_or_default)]
|
```
This commit is contained in:
parent
c73e7f5863
commit
3a51577b28
9 changed files with 32 additions and 31 deletions
|
|
@ -102,10 +102,10 @@ impl Write for FileLock {
|
|||
|
||||
impl Drop for FileLock {
|
||||
fn drop(&mut self) {
|
||||
if let Some(f) = self.f.take() {
|
||||
if let Err(e) = unlock(&f) {
|
||||
log::warn!("failed to release lock: {e:?}");
|
||||
}
|
||||
if let Some(f) = self.f.take()
|
||||
&& let Err(e) = unlock(&f)
|
||||
{
|
||||
log::warn!("failed to release lock: {e:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -360,10 +360,10 @@ impl<'a> Iterator for PathAncestors<'a> {
|
|||
if let Some(path) = self.current {
|
||||
self.current = path.parent();
|
||||
|
||||
if let Some(ref stop_at) = self.stop_at {
|
||||
if path == stop_at {
|
||||
self.current = None;
|
||||
}
|
||||
if let Some(ref stop_at) = self.stop_at
|
||||
&& path == stop_at
|
||||
{
|
||||
self.current = None;
|
||||
}
|
||||
|
||||
Some(path)
|
||||
|
|
@ -668,11 +668,11 @@ pub fn create_dir_all_excluded_from_backups_atomic(p: impl AsRef<Path>) -> Resul
|
|||
// existing behavior. If we get an error at rename() and suddenly the
|
||||
// directory (which didn't exist a moment earlier) exists we can infer from
|
||||
// it's another cargo process doing work.
|
||||
if let Err(e) = fs::rename(tempdir.path(), path) {
|
||||
if !path.exists() {
|
||||
return Err(anyhow::Error::from(e))
|
||||
.with_context(|| format!("failed to create directory `{}`", path.display()));
|
||||
}
|
||||
if let Err(e) = fs::rename(tempdir.path(), path)
|
||||
&& !path.exists()
|
||||
{
|
||||
return Err(anyhow::Error::from(e))
|
||||
.with_context(|| format!("failed to create directory `{}`", path.display()));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue