Skip to content

Commit 574a2ed

Browse files
committed
chore: normalize variant size for scoped_file_system::Entry
``` warning: large size difference between variants --> src/addon/file_server/scoped_file_system.rs:35:5 | 35 | File(File), | ^^^^^^^^^^ this variant is 304 bytes | = note: `#[warn(clippy::large_enum_variant)]` on by default note: and the second-largest variant is 24 bytes: --> src/addon/file_server/scoped_file_system.rs:36:5 | 36 | Directory(Directory), | ^^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant help: consider boxing the large fields to reduce the total size of the enum | 35 | File(Box<File>), | ~~~~~~~~~ ```
1 parent 1c87df9 commit 574a2ed

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "http-server"
3-
version = "0.5.4"
3+
version = "0.5.7"
44
authors = ["Esteban Borai <estebanborai@gmail.com>"]
55
edition = "2018"
66
description = "Simple and configurable command-line HTTP server"
@@ -40,7 +40,7 @@ handlebars = "4.1.4"
4040
hyper = { version = "0.14.14", features = ["http1", "server", "stream", "tcp"] }
4141
local-ip-address = "0.4.4"
4242
mime_guess = "2.0.3"
43-
rustls = "0.20.1"
43+
rustls = "0.20.2"
4444
rustls-pemfile = "0.2.1"
4545
tokio = { version = "1.13.0", features = ["fs", "rt-multi-thread", "signal", "macros"] }
4646
tokio-rustls = "0.23.1"

src/addon/file_server/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl<'a> FileServer {
104104
Ok(entry) => match entry {
105105
Entry::Directory(dir) => self.render_directory_index(dir.path()).await,
106106
Entry::File(file) => {
107-
make_http_file_response(file, CacheControlDirective::MaxAge(2500)).await
107+
make_http_file_response(*file, CacheControlDirective::MaxAge(2500)).await
108108
}
109109
},
110110
Err(err) => match err.kind() {

src/addon/file_server/scoped_file_system.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl Directory {
3232
/// `ScopedFileSystem`
3333
#[derive(Debug)]
3434
pub enum Entry {
35-
File(File),
35+
File(Box<File>),
3636
Directory(Directory),
3737
}
3838

@@ -109,7 +109,7 @@ impl ScopedFileSystem {
109109
return Ok(Entry::Directory(Directory { path: entry_path }));
110110
}
111111

112-
Ok(Entry::File(File::new(entry_path, file, metadata)))
112+
Ok(Entry::File(Box::new(File::new(entry_path, file, metadata))))
113113
}
114114
}
115115

0 commit comments

Comments
 (0)