Accept &str in Parse::parse_sql (#182)

It is more generic to accept a `&str` than a `String` in an API,
and avoids having to convert a string to a `String` when not
needed, avoiding a copy.
This commit is contained in:
Daniël Heres 2020-06-03 22:31:41 +02:00 committed by GitHub
parent b4699bd4a7
commit d32df527e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 8 deletions

View file

@ -45,7 +45,7 @@ fn main() {
chars.next();
chars.as_str()
};
let parse_result = Parser::parse_sql(&*dialect, without_bom.to_owned());
let parse_result = Parser::parse_sql(&*dialect, without_bom);
match parse_result {
Ok(statements) => {
println!(

View file

@ -23,7 +23,7 @@ fn main() {
let dialect = GenericDialect {};
let ast = Parser::parse_sql(&dialect, sql.to_string()).unwrap();
let ast = Parser::parse_sql(&dialect, sql).unwrap();
println!("AST: {:?}", ast);
}