mirror of
https://github.com/servo/servo.git
synced 2025-07-25 08:10:21 +01:00
clippy: Fix a bunch of warnings in script
(#32680)
This is just a portion of the errors that are remaining to be fixed.
This commit is contained in:
parent
93fdb8263d
commit
26624a109f
27 changed files with 150 additions and 113 deletions
|
@ -42,8 +42,9 @@ from Configuration import (
|
|||
AUTOGENERATED_WARNING_COMMENT = "/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n\n"
|
||||
ALLOWED_WARNING_LIST = ['non_camel_case_types', 'non_upper_case_globals', 'unused_imports',
|
||||
'unused_variables', 'unused_assignments', 'unused_mut',
|
||||
'clippy::approx_constant', 'clippy::let_unit_value', 'clippy::needless_return',
|
||||
'clippy::too_many_arguments', 'clippy::unnecessary_cast', 'clippy::upper_case_acronyms']
|
||||
'clippy::approx_constant', 'clippy::enum_variant_name', 'clippy::let_unit_value',
|
||||
'clippy::needless_return', 'clippy::too_many_arguments', 'clippy::unnecessary_cast',
|
||||
'clippy::upper_case_acronyms']
|
||||
ALLOWED_WARNINGS = f"#![allow({','.join(ALLOWED_WARNING_LIST)})]\n\n"
|
||||
|
||||
FINALIZE_HOOK_NAME = '_finalize'
|
||||
|
@ -1316,16 +1317,16 @@ def convertConstIDLValueToJSVal(value):
|
|||
tag = value.type.tag()
|
||||
if tag in [IDLType.Tags.int8, IDLType.Tags.uint8, IDLType.Tags.int16,
|
||||
IDLType.Tags.uint16, IDLType.Tags.int32]:
|
||||
return "ConstantVal::IntVal(%s)" % (value.value)
|
||||
return "ConstantVal::Int(%s)" % (value.value)
|
||||
if tag == IDLType.Tags.uint32:
|
||||
return "ConstantVal::UintVal(%s)" % (value.value)
|
||||
return "ConstantVal::Uint(%s)" % (value.value)
|
||||
if tag in [IDLType.Tags.int64, IDLType.Tags.uint64]:
|
||||
return "ConstantVal::DoubleVal(%s as f64)" % (value.value)
|
||||
return "ConstantVal::Double(%s as f64)" % (value.value)
|
||||
if tag == IDLType.Tags.bool:
|
||||
return "ConstantVal::BoolVal(true)" if value.value else "ConstantVal::BoolVal(false)"
|
||||
return "ConstantVal::Bool(true)" if value.value else "ConstantVal::BoolVal(false)"
|
||||
if tag in [IDLType.Tags.unrestricted_float, IDLType.Tags.float,
|
||||
IDLType.Tags.unrestricted_double, IDLType.Tags.double]:
|
||||
return "ConstantVal::DoubleVal(%s as f64)" % (value.value)
|
||||
return "ConstantVal::Double(%s as f64)" % (value.value)
|
||||
raise TypeError("Const value of unhandled type: " + value.type)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue