mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
opts.rs: don't accept multiple URLs. Fixes #5520.
Switched from opts.urls from being of type Vec to type String and changing the name to `url` as well. Changed the other files that are using opts.urls accordingly. servo/lib.rs + gonk/src/lib.rs: no need for a block scope. cef: fix compiler errors. - remove the use of `mut` since it's not needed. - use `to_owned` instead of `to_string` because it's more efficient.
This commit is contained in:
parent
c070ad6196
commit
74cd4cd56a
5 changed files with 28 additions and 38 deletions
|
@ -22,8 +22,8 @@ use std::rt;
|
|||
/// Global flags for Servo, currently set on the command line.
|
||||
#[derive(Clone)]
|
||||
pub struct Opts {
|
||||
/// The initial URLs to load.
|
||||
pub urls: Vec<String>,
|
||||
/// The initial URL to load.
|
||||
pub url: String,
|
||||
|
||||
/// How many threads to use for CPU painting (`-t`).
|
||||
///
|
||||
|
@ -176,7 +176,7 @@ static FORCE_CPU_PAINTING: bool = false;
|
|||
|
||||
pub fn default_opts() -> Opts {
|
||||
Opts {
|
||||
urls: vec!(),
|
||||
url: String::new(),
|
||||
paint_threads: 1,
|
||||
gpu_painting: false,
|
||||
tile_size: 512,
|
||||
|
@ -266,12 +266,12 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
|
|||
return false;
|
||||
}
|
||||
|
||||
let urls = if opt_match.free.is_empty() {
|
||||
let url = if opt_match.free.is_empty() {
|
||||
print_usage(app_name.as_slice(), opts.as_slice());
|
||||
args_fail("servo asks that you provide 1 or more URLs");
|
||||
args_fail("servo asks that you provide a URL");
|
||||
return false;
|
||||
} else {
|
||||
opt_match.free.clone()
|
||||
opt_match.free[0].clone()
|
||||
};
|
||||
|
||||
let tile_size: usize = match opt_match.opt_str("s") {
|
||||
|
@ -329,7 +329,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
|
|||
};
|
||||
|
||||
let opts = Opts {
|
||||
urls: urls,
|
||||
url: url,
|
||||
paint_threads: paint_threads,
|
||||
gpu_painting: gpu_painting,
|
||||
tile_size: tile_size,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue