From f7689f3154755a816bd3b35b58076c85478321c7 Mon Sep 17 00:00:00 2001 From: Lucien Greathouse Date: Tue, 27 Nov 2018 10:50:52 -0800 Subject: [PATCH] Take advantage of 2018 edition. - Remove explicit 'extern crate' fields where useful - Fix mutability of variable (unrelated?) - Add rbxmx dependency, which needs 2018 edition --- server/Cargo.lock | 19 ++++++++++++++++++- server/Cargo.toml | 1 + server/src/bin.rs | 3 --- server/src/lib.rs | 15 +++++---------- server/src/rbx_session.rs | 4 ++-- server/src/web.rs | 7 ++++++- 6 files changed, 32 insertions(+), 17 deletions(-) diff --git a/server/Cargo.lock b/server/Cargo.lock index b0d15526..d96eab56 100644 --- a/server/Cargo.lock +++ b/server/Cargo.lock @@ -641,13 +641,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rbx-tree" version = "0.1.0" -source = "git+https://github.com/LPGhatguy/rbx-tree.git#258b458cffbcbd01e3f1cf5bbd701cc75260f01a" +source = "git+https://github.com/LPGhatguy/rbx-tree.git#0fe8dacd013668e194afb1d074161477ebc759b6" dependencies = [ "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rbxmx" +version = "0.1.0" +source = "git+https://github.com/LPGhatguy/rbx-tree.git#0fe8dacd013668e194afb1d074161477ebc759b6" +dependencies = [ + "rbx-tree 0.1.0 (git+https://github.com/LPGhatguy/rbx-tree.git)", + "xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "redox_syscall" version = "0.1.40" @@ -700,6 +709,7 @@ dependencies = [ "notify 4.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "rbx-tree 0.1.0 (git+https://github.com/LPGhatguy/rbx-tree.git)", + "rbxmx 0.1.0 (git+https://github.com/LPGhatguy/rbx-tree.git)", "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "rouille 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1069,6 +1079,11 @@ dependencies = [ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "xml-rs" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [metadata] "checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c" "checksum aho-corasick 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "7ee94e9463ccb9d681e7b708082687b2c56d2bd420ca8a3d3157d27d59508ec0" @@ -1149,6 +1164,7 @@ dependencies = [ "checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" "checksum rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "edecf0f94da5551fc9b492093e30b041a891657db7940ee221f9d2f66e82eef2" "checksum rbx-tree 0.1.0 (git+https://github.com/LPGhatguy/rbx-tree.git)" = "" +"checksum rbxmx 0.1.0 (git+https://github.com/LPGhatguy/rbx-tree.git)" = "" "checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "67d0301b0c6804eca7e3c275119d0b01ff3b7ab9258a65709e608a66312a1025" @@ -1200,3 +1216,4 @@ dependencies = [ "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +"checksum xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "541b12c998c5b56aa2b4e6f18f03664eef9a4fd0a246a55594efae6cc2d964b5" diff --git a/server/Cargo.toml b/server/Cargo.toml index 022ef5a2..4ac23ec1 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -31,6 +31,7 @@ regex = "1.0" log = "0.4" env_logger = "0.5" rbx-tree = { git = "https://github.com/LPGhatguy/rbx-tree.git" } +rbxmx = { git = "https://github.com/LPGhatguy/rbx-tree.git" } uuid = { version = "0.7", features = ["v4", "serde"] } [dev-dependencies] diff --git a/server/src/bin.rs b/server/src/bin.rs index acef7ece..922cabc6 100644 --- a/server/src/bin.rs +++ b/server/src/bin.rs @@ -1,8 +1,5 @@ #[macro_use] extern crate clap; #[macro_use] extern crate log; -extern crate env_logger; - -extern crate librojo; use std::{ path::{Path, PathBuf}, diff --git a/server/src/lib.rs b/server/src/lib.rs index cde3cdb4..536f781b 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -1,13 +1,8 @@ -#[macro_use] extern crate log; -#[macro_use] extern crate rouille; -#[macro_use] extern crate serde_derive; -extern crate notify; -extern crate rand; -extern crate rbx_tree; -extern crate regex; -extern crate serde; -extern crate serde_json; -extern crate uuid; +#[macro_use] +extern crate log; + +#[macro_use] +extern crate serde_derive; #[cfg(test)] extern crate tempfile; diff --git a/server/src/rbx_session.rs b/server/src/rbx_session.rs index 0a721d17..52f73c08 100644 --- a/server/src/rbx_session.rs +++ b/server/src/rbx_session.rs @@ -35,7 +35,7 @@ impl PathIdTree { pub fn insert(&mut self, path: &Path, id: RbxId) { if let Some(parent_path) = path.parent() { - if let Some(mut parent) = self.nodes.get_mut(parent_path) { + if let Some(parent) = self.nodes.get_mut(parent_path) { parent.children.insert(path.to_path_buf()); } } @@ -48,7 +48,7 @@ impl PathIdTree { pub fn remove(&mut self, root_path: &Path) -> Option { if let Some(parent_path) = root_path.parent() { - if let Some(mut parent) = self.nodes.get_mut(parent_path) { + if let Some(parent) = self.nodes.get_mut(parent_path) { parent.children.remove(root_path); } } diff --git a/server/src/web.rs b/server/src/web.rs index c76ebe2e..168db49b 100644 --- a/server/src/web.rs +++ b/server/src/web.rs @@ -4,7 +4,12 @@ use std::{ sync::{mpsc, Arc}, }; -use rouille::{self, Request, Response}; +use rouille::{ + self, + router, + Request, + Response, +}; use rbx_tree::{RbxId, RootedRbxInstance}; use crate::{