diff --git a/src/nouveau/headers/lib_rs_gen.py b/src/nouveau/headers/lib_rs_gen.py index 0db41dc5cc3..d91cd4467dd 100644 --- a/src/nouveau/headers/lib_rs_gen.py +++ b/src/nouveau/headers/lib_rs_gen.py @@ -109,11 +109,6 @@ def main(): try: with open(args.out_rs, 'w', encoding='utf-8') as f: f.write(TEMPLATE_RS.render(root=root)) - try: - subprocess.run(['rustfmt', args.out_rs], check=True) - except (subprocess.CalledProcessError, FileNotFoundError): - pass - except Exception: # In the event there's an error, this imports some helpers from mako # to print a useful stack trace and prints it, then exits with @@ -124,5 +119,10 @@ def main(): print(exceptions.text_error_template().render(), file=sys.stderr) sys.exit(1) + try: + subprocess.run(['rustfmt', args.out_rs], check=True) + except (subprocess.CalledProcessError, FileNotFoundError): + pass + if __name__ == '__main__': main()