diff --git a/Cargo.toml b/Cargo.toml index 92213e8cb..a1f366cd4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ name = "rustpython" version = "0.0.1" authors = ["Windel Bouwman", "Shing Lyu "] +edition = "2018" [workspace] members = [".", "vm", "wasm/lib", "parser"] diff --git a/parser/Cargo.toml b/parser/Cargo.toml index d914a98a6..e57d42140 100644 --- a/parser/Cargo.toml +++ b/parser/Cargo.toml @@ -3,6 +3,7 @@ name = "rustpython_parser" version = "0.0.1" authors = [ "Shing Lyu", "Windel Bouwman" ] build = "build.rs" +edition = "2018" [build-dependencies] lalrpop="0.15.1" diff --git a/parser/build.rs b/parser/build.rs index 23c7d3f80..d35ace0c0 100644 --- a/parser/build.rs +++ b/parser/build.rs @@ -1,4 +1,4 @@ -extern crate lalrpop; +use lalrpop; fn main() { lalrpop::process_root().unwrap(); diff --git a/parser/src/error.rs b/parser/src/error.rs index f40d2abad..5239911d4 100644 --- a/parser/src/error.rs +++ b/parser/src/error.rs @@ -3,8 +3,8 @@ extern crate lalrpop_util; use self::lalrpop_util::ParseError as InnerError; -use lexer::{LexicalError, Location}; -use token::Tok; +use crate::lexer::{LexicalError, Location}; +use crate::token::Tok; use std::error::Error; use std::fmt; diff --git a/parser/src/lexer.rs b/parser/src/lexer.rs index f48c48d49..c13ad70ab 100644 --- a/parser/src/lexer.rs +++ b/parser/src/lexer.rs @@ -541,7 +541,7 @@ where fn is_char(&self) -> bool { match self.chr0 { - Some('a'...'z') | Some('A'...'Z') | Some('_') | Some('0'...'9') => true, + Some('a'..='z') | Some('A'..='Z') | Some('_') | Some('0'..='9') => true, _ => false, } } @@ -549,19 +549,19 @@ where fn is_number(&self, radix: u32) -> bool { match radix { 2 => match self.chr0 { - Some('0'...'1') => true, + Some('0'..='1') => true, _ => false, }, 8 => match self.chr0 { - Some('0'...'7') => true, + Some('0'..='7') => true, _ => false, }, 10 => match self.chr0 { - Some('0'...'9') => true, + Some('0'..='9') => true, _ => false, }, 16 => match self.chr0 { - Some('0'...'9') | Some('a'...'f') | Some('A'...'F') => true, + Some('0'..='9') | Some('a'..='f') | Some('A'..='F') => true, _ => false, }, x => unimplemented!("Radix not implemented: {}", x), @@ -686,8 +686,8 @@ where } match self.chr0 { - Some('0'...'9') => return Some(self.lex_number()), - Some('_') | Some('a'...'z') | Some('A'...'Z') => return Some(self.lex_identifier()), + Some('0'..='9') => return Some(self.lex_number()), + Some('_') | Some('a'..='z') | Some('A'..='Z') => return Some(self.lex_identifier()), Some('#') => { self.lex_comment(); continue; diff --git a/parser/src/lib.rs b/parser/src/lib.rs index 8deba2c41..f7f369968 100644 --- a/parser/src/lib.rs +++ b/parser/src/lib.rs @@ -1,9 +1,6 @@ #[macro_use] extern crate log; -extern crate num_bigint; -extern crate num_traits; - pub mod ast; pub mod error; pub mod lexer; diff --git a/parser/src/parser.rs b/parser/src/parser.rs index ae7f88f31..a5380017d 100644 --- a/parser/src/parser.rs +++ b/parser/src/parser.rs @@ -1,5 +1,3 @@ -extern crate lalrpop_util; - use std::iter; use super::ast; diff --git a/py_code_object/Cargo.toml b/py_code_object/Cargo.toml index 59e1e3efe..abb2d7832 100644 --- a/py_code_object/Cargo.toml +++ b/py_code_object/Cargo.toml @@ -2,6 +2,7 @@ name = "py_code_object" version = "0.1.0" authors = ["Shing Lyu "] +edition = "2018" [dependencies] log = "0.3" diff --git a/py_code_object/python_compiler/Cargo.toml b/py_code_object/python_compiler/Cargo.toml index 505bc8f4f..1a301ee87 100644 --- a/py_code_object/python_compiler/Cargo.toml +++ b/py_code_object/python_compiler/Cargo.toml @@ -2,6 +2,7 @@ name = "python_compiler" version = "0.1.0" authors = ["Shing Lyu "] +edition = "2018" [dependencies] cpython = { git = "https://github.com/dgrunwald/rust-cpython.git" } diff --git a/vm/Cargo.toml b/vm/Cargo.toml index 0dc048c8c..f0ab63aab 100644 --- a/vm/Cargo.toml +++ b/vm/Cargo.toml @@ -2,6 +2,7 @@ name = "rustpython_vm" version = "0.1.0" authors = ["Shing Lyu "] +edition = "2018" [dependencies] bitflags = "1.0.4" diff --git a/vm/src/import.rs b/vm/src/import.rs index c127a8149..42ab0e25f 100644 --- a/vm/src/import.rs +++ b/vm/src/import.rs @@ -9,7 +9,7 @@ use super::compile; use super::pyobject::{DictProtocol, PyResult}; use super::util; use super::vm::VirtualMachine; -use obj::{objsequence, objstr}; +use crate::obj::{objsequence, objstr}; fn import_uncached_module( vm: &mut VirtualMachine, diff --git a/vm/src/stdlib/random.rs b/vm/src/stdlib/random.rs index a6952be51..417cf8fa2 100644 --- a/vm/src/stdlib/random.rs +++ b/vm/src/stdlib/random.rs @@ -5,7 +5,7 @@ extern crate rand; use super::super::obj::{objfloat, objtype}; use super::super::pyobject::{PyContext, PyFuncArgs, PyObjectRef, PyResult, TypeProtocol}; use super::super::VirtualMachine; -use stdlib::random::rand::distributions::{Distribution, Normal}; +use crate::stdlib::random::rand::distributions::{Distribution, Normal}; pub fn mk_module(ctx: &PyContext) -> PyObjectRef { let py_mod = ctx.new_module(&"random".to_string(), ctx.new_scope(None)); diff --git a/vm/src/sysmodule.rs b/vm/src/sysmodule.rs index e5c701fd6..e7aad4430 100644 --- a/vm/src/sysmodule.rs +++ b/vm/src/sysmodule.rs @@ -1,8 +1,8 @@ -use obj::objtype; -use pyobject::{PyContext, PyFuncArgs, PyObjectRef, PyResult, TypeProtocol}; +use crate::obj::objtype; +use crate::pyobject::{PyContext, PyFuncArgs, PyObjectRef, PyResult, TypeProtocol}; +use crate::vm::VirtualMachine; use std::rc::Rc; use std::{env, mem}; -use vm::VirtualMachine; /* * The magic sys module. diff --git a/wasm/lib/Cargo.toml b/wasm/lib/Cargo.toml index 6c78e0640..ac5da7450 100644 --- a/wasm/lib/Cargo.toml +++ b/wasm/lib/Cargo.toml @@ -5,6 +5,7 @@ authors = ["Ryan Liddle "] license = "MIT" description = "A Python-3 (CPython >= 3.5.0) Interpreter written in Rust, compiled to WASM" repository = "https://github.com/RustPython/RustPython/tree/master/wasm/lib" +edition = "2018" [lib] crate-type = ["cdylib", "rlib"]