Skip to content

Commit 733fe1d

Browse files
committed
make functions static where possible
1 parent 3545785 commit 733fe1d

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

src/etc/gdb_rust_pretty_printing.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ class RustSlicePrinter:
209209
def __init__(self, val):
210210
self.__val = val
211211

212-
def display_hint(self):
212+
@staticmethod
213+
def display_hint():
213214
return "array"
214215

215216
def to_string(self):
@@ -240,7 +241,8 @@ class RustStdVecPrinter:
240241
def __init__(self, val):
241242
self.__val = val
242243

243-
def display_hint(self):
244+
@staticmethod
245+
def display_hint():
244246
return "array"
245247

246248
def to_string(self):

src/etc/platform-intrinsics/generator.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,19 @@ class Void(Type):
119119
def __init__(self):
120120
Type.__init__(self, 0)
121121

122-
def compiler_ctor(self):
122+
@staticmethod
123+
def compiler_ctor():
123124
return '::VOID'
124125

125126
def compiler_ctor_ref(self):
126127
return '&' + self.compiler_ctor()
127128

128-
def rust_name(self):
129+
@staticmethod
130+
def rust_name():
129131
return '()'
130132

131-
def type_info(self, platform_info):
133+
@staticmethod
134+
def type_info(platform_info):
132135
return None
133136

134137
def __eq__(self, other):
@@ -756,22 +759,26 @@ class ExternBlock(object):
756759
def __init__(self):
757760
pass
758761

759-
def open(self, platform):
762+
@staticmethod
763+
def open(platform):
760764
return 'extern "platform-intrinsic" {'
761765

762-
def render(self, mono):
766+
@staticmethod
767+
def render(mono):
763768
return ' fn {}{}{};'.format(mono.platform_prefix(),
764769
mono.intrinsic_name(),
765770
mono.intrinsic_signature())
766771

767-
def close(self):
772+
@staticmethod
773+
def close():
768774
return '}'
769775

770776
class CompilerDefs(object):
771777
def __init__(self):
772778
pass
773779

774-
def open(self, platform):
780+
@staticmethod
781+
def open(platform):
775782
return '''\
776783
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
777784
// file at the top-level directory of this distribution and at
@@ -798,7 +805,8 @@ def open(self, platform):
798805
if !name.starts_with("{0}") {{ return None }}
799806
Some(match &name["{0}".len()..] {{'''.format(platform.platform_prefix())
800807

801-
def render(self, mono):
808+
@staticmethod
809+
def render(mono):
802810
return '''\
803811
"{}" => Intrinsic {{
804812
inputs: {{ static INPUTS: [&'static Type; {}] = [{}]; &INPUTS }},
@@ -810,7 +818,8 @@ def render(self, mono):
810818
mono.compiler_ret(),
811819
mono.llvm_name())
812820

813-
def close(self):
821+
@staticmethod
822+
def close():
814823
return '''\
815824
_ => return None,
816825
})

0 commit comments

Comments
 (0)