Skip to content

Commit 9b308bb

Browse files
committed
fix(cosmetics): nicer code and identifiers
1 parent 54540e6 commit 9b308bb

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/mako/lib/lib.mako

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Handle the following *Resources* with ease ...
2727
md_methods = list()
2828
for method in sorted(c.rta_map[r]):
2929
if rust_doc:
30-
md_methods.append("[*%s*](struct.%s.html)" % (method, mb_type(r, method)))
30+
md_methods.append("[*%s*](struct.%s.html)" % (' '.join(n.lower() for n in reversed(method.split('.'))), mb_type(r, method)))
3131
else:
3232
# TODO: link to final destination, possibly just have one for all ...
3333
md_methods.append("*%s*" % method)

src/mako/lib/rbuild.mako

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,18 @@ impl${rb_params} ${ThisType} {
6767
# we would could have information about data requirements for each property in it's dict.
6868
# for now, we just hardcode it, and treat the entries as way to easily change param names
6969
assert len(api.properties) == 2, "Hardcoded for now, thanks to scope requirements"
70+
71+
type_params = ''
72+
if mb_additional_type_params(m):
73+
type_params = '<%s>' % ', '.join(mb_additional_type_params(m))
7074
%>\
7175
7276
% if 'description' in m:
7377
/// Create a builder to help you perform the following task:
7478
///
7579
${m.description | rust_doc_comment, indent_all_but_first_by(1)}
7680
% endif
77-
pub fn ${mangle_ident(a)}<${', '.join(mb_additional_type_params(m))}>(&self${method_args}) -> ${RType}${mb_tparams} {
81+
pub fn ${mangle_ident(a)}${type_params}(&self${method_args}) -> ${RType}${mb_tparams} {
7882
${RType} {
7983
hub: self.hub,
8084
% for p in required_props:

src/mako/lib/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def nested_type_name(sn, pn):
254254

255255
# Make properties which are reserved keywords usable
256256
def mangle_ident(n):
257-
n = camel_to_under(n).replace('-', '.').replace('.', '').replace('$', '')
257+
n = camel_to_under(n).replace('-', '.').replace('.', '_').replace('$', '')
258258
if n in RESERVED_WORDS:
259259
return n + '_'
260260
return n

0 commit comments

Comments
 (0)