diff --git a/src/dmdoc/main.rs b/src/dmdoc/main.rs index 44b244d4..fb6505d3 100644 --- a/src/dmdoc/main.rs +++ b/src/dmdoc/main.rs @@ -35,7 +35,7 @@ thread_local! { static ALL_TYPE_NAMES: RefCell> = Default::default(); } -fn main() -> Result<(), Box> { +fn main() -> Result<(), Box> { for arg in std::env::args() { if arg == "-V" || arg == "--version" { println!("{}", BUILD_INFO); diff --git a/src/dreammaker/error.rs b/src/dreammaker/error.rs index 0810cbf9..73b098ab 100644 --- a/src/dreammaker/error.rs +++ b/src/dreammaker/error.rs @@ -329,7 +329,7 @@ pub struct DMError { component: Component, description: String, notes: Vec, - cause: Option>, + cause: Option>, } /// An additional note attached to an error, at some other location. @@ -426,8 +426,8 @@ impl error::Error for DMError { &self.description } - fn cause(&self) -> Option<&error::Error> { - self.cause.as_ref().map(|x| &**x as &error::Error) + fn cause(&self) -> Option<&dyn error::Error> { + self.cause.as_ref().map(|x| &**x as &dyn error::Error) } } diff --git a/src/dreammaker/lexer.rs b/src/dreammaker/lexer.rs index 1536cbf2..e3e1edfa 100644 --- a/src/dreammaker/lexer.rs +++ b/src/dreammaker/lexer.rs @@ -1141,8 +1141,8 @@ impl<'ctx, I: Iterator>> Iterator for Lexer<'ctx, I> { } Some(v) => Some(locate(Punct(v))), None => match first { - b'0'...b'9' => Some(locate(self.read_number(first))), - b'_' | b'a'...b'z' | b'A'...b'Z' => { + b'0'..=b'9' => Some(locate(self.read_number(first))), + b'_' | b'a'..=b'z' | b'A'..=b'Z' => { let ident = self.read_ident(first); let next = self.next(); self.put_back(next); diff --git a/src/dreammaker/preprocessor.rs b/src/dreammaker/preprocessor.rs index c65e7479..3bac43df 100644 --- a/src/dreammaker/preprocessor.rs +++ b/src/dreammaker/preprocessor.rs @@ -161,7 +161,7 @@ enum Include<'ctx> { File { path: PathBuf, file: FileId, - lexer: Lexer<'ctx, io::Bytes>>, + lexer: Lexer<'ctx, io::Bytes>>, }, Expansion { name: String, @@ -171,7 +171,7 @@ enum Include<'ctx> { } impl<'ctx> Include<'ctx> { - fn from_read(context: &'ctx Context, path: PathBuf, read: Box) -> Include { + fn from_read(context: &'ctx Context, path: PathBuf, read: Box) -> Include { let idx = context.register_file(&path); Include::File { file: idx, diff --git a/src/langserver/document.rs b/src/langserver/document.rs index 8e40d69a..81c60057 100644 --- a/src/langserver/document.rs +++ b/src/langserver/document.rs @@ -88,14 +88,14 @@ impl DocumentStore { format!("URL not opened and schema is not 'file': {}", url))); } - pub fn read(&self, url: &Url) -> io::Result> { + pub fn read(&self, url: &Url) -> io::Result> { if let Some(document) = self.map.get(url) { - return Ok(Box::new(Cursor::new(document.text.clone())) as Box); + return Ok(Box::new(Cursor::new(document.text.clone())) as Box); } if let Ok(path) = ::url_to_path(url) { let file = ::std::fs::File::open(path)?; - return Ok(Box::new(file) as Box); + return Ok(Box::new(file) as Box); } return Err(io::Error::new(io::ErrorKind::NotFound, diff --git a/src/tools/minimap.rs b/src/tools/minimap.rs index fab4cc06..6682504c 100644 --- a/src/tools/minimap.rs +++ b/src/tools/minimap.rs @@ -23,7 +23,7 @@ pub struct Context<'a> { pub grid: Grid<'a>, pub min: (usize, usize), pub max: (usize, usize), - pub render_passes: &'a [Box], + pub render_passes: &'a [Box], pub errors: &'a RwLock>, } @@ -268,7 +268,7 @@ pub fn get_atom_list<'a>( objtree: &'a ObjectTree, prefabs: &'a [Prefab], loc: (u32, u32), - render_passes: &[Box], + render_passes: &[Box], errors: Option<&RwLock>>, ) -> Vec> { let mut result = Vec::new(); diff --git a/src/tools/render_passes/mod.rs b/src/tools/render_passes/mod.rs index 495f6f54..f37bd241 100644 --- a/src/tools/render_passes/mod.rs +++ b/src/tools/render_passes/mod.rs @@ -62,7 +62,7 @@ pub struct RenderPassInfo { pub name: &'static str, pub desc: &'static str, pub default: bool, - pub new: fn() -> Box, + pub new: fn() -> Box, } macro_rules! pass { @@ -88,7 +88,7 @@ pub const RENDER_PASSES: &[RenderPassInfo] = &[ pass!(Pipes, "only-pipenet", "Render only atmospheric pipes.", false), ]; -pub fn configure(include: &str, exclude: &str) -> Vec> { +pub fn configure(include: &str, exclude: &str) -> Vec> { let include: Vec<&str> = include.split(",").collect(); let exclude: Vec<&str> = exclude.split(",").collect(); let include_all = include.iter().any(|&name| name == "all"); diff --git a/src/tools/utils.rs b/src/tools/utils.rs index b0ed1f13..3da8efd1 100644 --- a/src/tools/utils.rs +++ b/src/tools/utils.rs @@ -49,7 +49,7 @@ impl Iterator for Chars { } } -fn read_one_byte(reader: &mut Read) -> Option> { +fn read_one_byte(reader: &mut dyn Read) -> Option> { let mut buf = [0]; loop { return match reader.read(&mut buf) {