rust/src/bin/rustfmt.rs

43 lines
1.5 KiB
Rust
Raw Normal View History

// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(exit_status)]
extern crate rustfmt;
use rustfmt::{WriteMode, run};
fn main() {
let args: Vec<_> = std::env::args().collect();
//run(args, WriteMode::Display);
run(args, WriteMode::Overwrite);
std::env::set_exit_status(0);
// TODO unit tests
// let fmt = ListFormatting {
// tactic: ListTactic::Horizontal,
// separator: ",",
// trailing_separator: SeparatorTactic::Vertical,
// indent: 2,
// h_width: 80,
// v_width: 100,
// };
// let inputs = vec![(format!("foo"), String::new()),
// (format!("foo"), String::new()),
// (format!("foo"), String::new()),
// (format!("foo"), String::new()),
// (format!("foo"), String::new()),
// (format!("foo"), String::new()),
// (format!("foo"), String::new()),
// (format!("foo"), String::new())];
// let s = write_list(&inputs, &fmt);
// println!(" {}", s);
}