Skip to content

Commit 691c507

Browse files
committed
Derive Default for CachePolicy
Thanks to `cargo clippy` for the suggestion. See https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls for background.
1 parent 3666345 commit 691c507

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/passthrough/mod.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ unsafe impl ByteValued for LinuxDirent64 {}
342342
/// The caching policy that the file system should report to the FUSE client. By default the FUSE
343343
/// protocol uses close-to-open consistency. This means that any cached contents of the file are
344344
/// invalidated the next time that file is opened.
345-
#[derive(Debug, Clone, Eq, PartialEq)]
345+
#[derive(Debug, Default, Clone, Eq, PartialEq)]
346346
pub enum CachePolicy {
347347
/// The client should never cache file data and all I/O should be directly forwarded to the
348348
/// server. This policy must be selected when file contents may change without the knowledge of
@@ -351,6 +351,7 @@ pub enum CachePolicy {
351351

352352
/// The client is free to choose when and how to cache file data. This is the default policy and
353353
/// uses close-to-open consistency as described in the enum documentation.
354+
#[default]
354355
Auto,
355356

356357
/// The client should always cache file data. This means that the FUSE client will not
@@ -373,12 +374,6 @@ impl FromStr for CachePolicy {
373374
}
374375
}
375376

376-
impl Default for CachePolicy {
377-
fn default() -> Self {
378-
CachePolicy::Auto
379-
}
380-
}
381-
382377
/// Options that configure the behavior of the passthrough fuse file system.
383378
#[derive(Debug, Clone, Eq, PartialEq)]
384379
pub struct Config {

0 commit comments

Comments
 (0)