Switch most crates to the 2018 edition

This commit is contained in:
Simon Sapin 2018-11-01 19:15:13 +01:00
parent 76e59a46d3
commit 9f9bf8f6bc
57 changed files with 82 additions and 28 deletions

View file

@ -5686,7 +5686,11 @@ class CGInterfaceTrait(CGThing):
yield name, arguments, rettype
def fmt(arguments):
return "".join(", %s: %s" % argument for argument in arguments)
keywords = {"async"}
return "".join(
", %s: %s" % (name if name not in keywords else "r#" + name, type_)
for name, type_ in arguments
)
def contains_unsafe_arg(arguments):
if not arguments or len(arguments) == 0:
@ -6250,7 +6254,7 @@ class CGDictionary(CGThing):
d = self.dictionary
if d.parent:
initParent = ("{\n"
" match try!(%s::%s::new(cx, val)) {\n"
" match r#try!(%s::%s::new(cx, val)) {\n"
" ConversionResult::Success(v) => v,\n"
" ConversionResult::Failure(error) => {\n"
" throw_type_error(cx, &error);\n"
@ -6396,7 +6400,7 @@ class CGDictionary(CGThing):
conversion = (
"{\n"
" rooted!(in(cx) let mut rval = UndefinedValue());\n"
" match try!(get_dictionary_property(cx, object.handle(), \"%s\", rval.handle_mut())) {\n"
" match r#try!(get_dictionary_property(cx, object.handle(), \"%s\", rval.handle_mut())) {\n"
" true => {\n"
"%s\n"
" },\n"
@ -7167,7 +7171,7 @@ class CallbackOperationBase(CallbackMethod):
"methodName": self.methodName
}
getCallableFromProp = string.Template(
'try!(self.parent.get_callable_property(cx, "${methodName}"))'
'r#try!(self.parent.get_callable_property(cx, "${methodName}"))'
).substitute(replacements)
if not self.singleOperation:
return 'rooted!(in(cx) let callable =\n' + getCallableFromProp + ');\n'