summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2022-11-10 10:59:56 -0800
committerDylan Baker <dylan@pnwbakers.com>2022-12-05 12:22:09 -0800
commit24b00240650c41b98c51764b6d2f4754bc04dae1 (patch)
tree5bb33fa81e8e5d53c07df540a55a7adc5ef32a4d
parent33ba2c6f9554aaeb9a8346c7f9c08968ccd54ace (diff)
downloadmeson-24b00240650c41b98c51764b6d2f4754bc04dae1.tar.gz
modules/rust: Use `__future__.annotations`
-rw-r--r--mesonbuild/modules/rust.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/mesonbuild/modules/rust.py b/mesonbuild/modules/rust.py
index 87e36c52d..078dedfcf 100644
--- a/mesonbuild/modules/rust.py
+++ b/mesonbuild/modules/rust.py
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import annotations
import os
import typing as T
@@ -52,9 +53,9 @@ class RustModule(ExtensionModule):
INFO = ModuleInfo('rust', '0.57.0', stabilized='1.0.0')
- def __init__(self, interpreter: 'Interpreter') -> None:
+ def __init__(self, interpreter: Interpreter) -> None:
super().__init__(interpreter)
- self._bindgen_bin: T.Optional['ExternalProgram'] = None
+ self._bindgen_bin: T.Optional[ExternalProgram] = None
self.methods.update({
'test': self.test,
'bindgen': self.bindgen,
@@ -67,7 +68,7 @@ class RustModule(ExtensionModule):
DEPENDENCIES_KW,
KwargInfo('is_parallel', bool, default=False),
)
- def test(self, state: 'ModuleState', args: T.Tuple[str, BuildTarget], kwargs: 'FuncTest') -> ModuleReturnValue:
+ def test(self, state: ModuleState, args: T.Tuple[str, BuildTarget], kwargs: FuncTest) -> ModuleReturnValue:
"""Generate a rust test target from a given rust target.
Rust puts it's unitests inside it's main source files, unlike most
@@ -173,7 +174,7 @@ class RustModule(ExtensionModule):
INCLUDE_DIRECTORIES.evolve(feature_validator=include_dir_string_new),
OUTPUT_KW,
)
- def bindgen(self, state: 'ModuleState', args: T.List, kwargs: 'FuncBindgen') -> ModuleReturnValue:
+ def bindgen(self, state: ModuleState, args: T.List, kwargs: FuncBindgen) -> ModuleReturnValue:
"""Wrapper around bindgen to simplify it's use.
The main thing this simplifies is the use of `include_directory`
@@ -182,7 +183,7 @@ class RustModule(ExtensionModule):
header, *_deps = self.interpreter.source_strings_to_files(kwargs['input'])
# Split File and Target dependencies to add pass to CustomTarget
- depends: T.List['SourceOutputs'] = []
+ depends: T.List[SourceOutputs] = []
depend_files: T.List[File] = []
for d in _deps:
if isinstance(d, File):
@@ -232,5 +233,5 @@ class RustModule(ExtensionModule):
return ModuleReturnValue([target], [target])
-def initialize(interp: 'Interpreter') -> RustModule:
+def initialize(interp: Interpreter) -> RustModule:
return RustModule(interp)