mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Fix obsolete format traits.
They are to be removed from the language in the next rust upgrade.
This commit is contained in:
parent
141b5d038f
commit
b51e83819d
35 changed files with 63 additions and 63 deletions
|
@ -85,7 +85,7 @@ impl ActorRegistry {
|
|||
}
|
||||
|
||||
pub fn register_script_actor(&self, script_id: String, actor: String) {
|
||||
println!("registering {:s} ({:s})", actor.as_slice(), script_id.as_slice());
|
||||
println!("registering {} ({})", actor.as_slice(), script_id.as_slice());
|
||||
let mut script_actors = self.script_actors.borrow_mut();
|
||||
script_actors.insert(script_id, actor);
|
||||
}
|
||||
|
@ -103,19 +103,19 @@ impl ActorRegistry {
|
|||
|
||||
pub fn actor_to_script(&self, actor: String) -> String {
|
||||
for (key, value) in self.script_actors.borrow().iter() {
|
||||
println!("checking {:s}", value.as_slice());
|
||||
println!("checking {}", value.as_slice());
|
||||
if value.as_slice() == actor.as_slice() {
|
||||
return key.to_string();
|
||||
}
|
||||
}
|
||||
panic!("couldn't find actor named {:s}", actor)
|
||||
panic!("couldn't find actor named {}", actor)
|
||||
}
|
||||
|
||||
/// Create a unique name based on a monotonically increasing suffix
|
||||
pub fn new_name(&self, prefix: &str) -> String {
|
||||
let suffix = self.next.get();
|
||||
self.next.set(suffix + 1);
|
||||
format!("{:s}{:u}", prefix, suffix)
|
||||
format!("{}{}", prefix, suffix)
|
||||
}
|
||||
|
||||
/// Add an actor to the registry of known actors that can receive messages.
|
||||
|
@ -154,11 +154,11 @@ impl ActorRegistry {
|
|||
-> Result<(), ()> {
|
||||
let to = msg.get(&"to".to_string()).unwrap().as_string().unwrap();
|
||||
match self.actors.get(&to.to_string()) {
|
||||
None => println!("message received for unknown actor \"{:s}\"", to),
|
||||
None => println!("message received for unknown actor \"{}\"", to),
|
||||
Some(actor) => {
|
||||
let msg_type = msg.get(&"type".to_string()).unwrap().as_string().unwrap();
|
||||
if !try!(actor.handle_message(self, &msg_type.to_string(), msg, stream)) {
|
||||
println!("unexpected message type \"{:s}\" found for actor \"{:s}\"",
|
||||
println!("unexpected message type \"{}\" found for actor \"{}\"",
|
||||
msg_type, to);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ impl Actor for ConsoleActor {
|
|||
messages.push(json::from_str(json::encode(&message).as_slice()).unwrap().as_object().unwrap().clone());*/
|
||||
}
|
||||
|
||||
s => println!("unrecognized message type requested: \"{:s}\"", s),
|
||||
s => println!("unrecognized message type requested: \"{}\"", s),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ pub trait JsonPacketStream {
|
|||
impl JsonPacketStream for TcpStream {
|
||||
fn write_json_packet<'a, T: Encodable<json::Encoder<'a>,IoError>>(&mut self, obj: &T) {
|
||||
let s = json::encode(obj).replace("__type__", "type");
|
||||
println!("<- {:s}", s);
|
||||
println!("<- {}", s);
|
||||
self.write_str(s.len().to_string().as_slice()).unwrap();
|
||||
self.write_u8(':' as u8).unwrap();
|
||||
self.write_str(s.as_slice()).unwrap();
|
||||
|
@ -35,7 +35,7 @@ impl JsonPacketStream for TcpStream {
|
|||
let packet_len = num::from_str_radix(packet_len_str.as_slice(), 10).unwrap();
|
||||
let packet_buf = self.read_exact(packet_len).unwrap();
|
||||
let packet = String::from_utf8(packet_buf).unwrap();
|
||||
println!("{:s}", packet);
|
||||
println!("{}", packet);
|
||||
return Ok(json::from_str(packet.as_slice()).unwrap())
|
||||
},
|
||||
Err(ref e) if e.kind == EndOfFile =>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue