Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
derive-msg-formats 5/5: Remove placeholder implementations
# This commit has been generated via the following Python script: # (followed by `cargo +nightly fmt` and `cargo dev generate-all`) # For the reasoning see the previous commit(s). import re import sys for path in ( 'src/violations.rs', 'src/rules/flake8_tidy_imports/banned_api.rs', 'src/rules/flake8_tidy_imports/relative_imports.rs', ): with open(path) as f: text = '' while line := next(f, None): if line.strip() != 'fn message(&self) -> String {': text += line continue text += ' #[derive_message_formats]\n' + line body = next(f) while (line := next(f)) != ' }\n': body += line # body = re.sub(r'(?<!code\| |\.push\()format!', 'format!', body) body = re.sub( r'("[^"]+")\s*\.to_string\(\)', r'format!(\1)', body, re.DOTALL ) body = re.sub( r'(r#".+?"#)\s*\.to_string\(\)', r'format!(\1)', body, re.DOTALL ) text += body + ' }\n' while (line := next(f)).strip() != 'fn placeholder() -> Self {': text += line while (line := next(f)) != ' }\n': pass with open(path, 'w') as f: f.write(text)
- Loading branch information