Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
vadimcn committed May 29, 2020
1 parent 407a46b commit b101dc3
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
},
{
"type": "process",
"label": "rustfmt",
"label": "Format current file",
"command": "rustfmt",
"args": [
"${file}"
Expand Down
2 changes: 1 addition & 1 deletion adapter2/deps/debug-protocol/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(non_camel_case_types)]
#![cfg(not(feature = "test"))]

use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};

schemafy::schemafy!("adapter2/deps/debug-protocol/src/debugAdapterProtocol.json");

Expand Down
14 changes: 10 additions & 4 deletions adapter2/deps/lldb/src/sbattachinfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ impl SBAttachInfo {
})
}
pub fn set_executable(&self, path: &str) {
with_cstr(path, |path|
with_cstr(path, |path| {
cpp!(unsafe [self as "SBAttachInfo*", path as "const char*"] {
self->SetExecutable(path);
})
);
});
}
/// Set attach by process name settings.
///
Expand Down Expand Up @@ -87,7 +87,13 @@ impl SBAttachInfo {

impl fmt::Debug for SBAttachInfo {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Attach info: pid = {}, wait_for = {}, ignore_existing = {}, resume_count = {}", //.
self.process_id(), self.wait_for_launch(), self.ignore_existing(), self.resume_count())
write!(
f,
"Attach info: pid = {}, wait_for = {}, ignore_existing = {}, resume_count = {}",
self.process_id(),
self.wait_for_launch(),
self.ignore_existing(),
self.resume_count()
)
}
}
4 changes: 3 additions & 1 deletion adapter2/deps/lldb/src/sbbreakpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ impl SBBreakpoint {
F: FnMut(&SBProcess, &SBThread, &SBBreakpointLocation) -> bool + Send + 'static,
{
unsafe extern "C" fn callback_thunk(
_baton: *mut c_void, process: *const SBProcess, thread: *const SBThread,
_baton: *mut c_void,
process: *const SBProcess,
thread: *const SBThread,
location: *const SBBreakpointLocation,
) -> bool {
let bp_id = (*location).breakpoint().id();
Expand Down
16 changes: 13 additions & 3 deletions adapter2/deps/lldb/src/sbcommandinterpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ unsafe impl Send for SBCommandInterpreter {}

impl SBCommandInterpreter {
pub fn handle_command(
&self, command: &str, result: &mut SBCommandReturnObject, add_to_history: bool,
&self,
command: &str,
result: &mut SBCommandReturnObject,
add_to_history: bool,
) -> ReturnStatus {
with_cstr(command, |command| {
cpp!(unsafe [self as "SBCommandInterpreter*", command as "const char*",
Expand All @@ -16,7 +19,11 @@ impl SBCommandInterpreter {
})
}
pub fn handle_command_with_context(
&self, command: &str, context: &SBExecutionContext, result: &mut SBCommandReturnObject, add_to_history: bool,
&self,
command: &str,
context: &SBExecutionContext,
result: &mut SBCommandReturnObject,
add_to_history: bool,
) -> ReturnStatus {
with_cstr(command, |command| {
cpp!(unsafe [self as "SBCommandInterpreter*", command as "const char*", context as "SBExecutionContext*",
Expand All @@ -26,7 +33,10 @@ impl SBCommandInterpreter {
})
}
pub fn handle_completions(
&self, current_line: &str, cursor_pos: u32, range: Option<(u32, u32)>,
&self,
current_line: &str,
cursor_pos: u32,
range: Option<(u32, u32)>,
) -> Option<(String, Vec<String>)> {
unsafe {
let line_start = if current_line.is_empty() {
Expand Down
14 changes: 12 additions & 2 deletions adapter2/deps/lldb/src/sblistener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,25 @@ impl SBListener {
})
}
// returns effective event mask
pub fn start_listening_for_event_class(&self, debugger: &SBDebugger, broadcaster_class: &str, event_mask: u32) -> u32 {
pub fn start_listening_for_event_class(
&self,
debugger: &SBDebugger,
broadcaster_class: &str,
event_mask: u32,
) -> u32 {
with_cstr(broadcaster_class, |broadcaster_class| {
cpp!(unsafe [self as "SBListener*", debugger as "SBDebugger*",
broadcaster_class as "const char*", event_mask as "uint32_t"] -> u32 as "uint32_t" {
return self->StartListeningForEventClass(*debugger, broadcaster_class, event_mask);
})
})
}
pub fn stop_listening_for_event_class(&self, debugger: &SBDebugger, broadcaster_class: &str, event_mask: u32) -> bool {
pub fn stop_listening_for_event_class(
&self,
debugger: &SBDebugger,
broadcaster_class: &str,
event_mask: u32,
) -> bool {
with_cstr(broadcaster_class, |broadcaster_class| {
cpp!(unsafe [self as "SBListener*", debugger as "SBDebugger*",
broadcaster_class as "const char*", event_mask as "uint32_t"] -> bool as "bool" {
Expand Down
8 changes: 6 additions & 2 deletions adapter2/deps/lldb/src/sbtarget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ impl SBTarget {
pub fn find_breakpoint_by_id(&self, id: BreakpointID) -> Option<SBBreakpoint> {
cpp!(unsafe [self as "SBTarget*", id as "break_id_t"] -> SBBreakpoint as "SBBreakpoint" {
return self->FindBreakpointByID(id);
}).check()
})
.check()
}
pub fn breakpoint_create_by_location(&self, file: &str, line: u32) -> SBBreakpoint {
with_cstr(file, |file| {
Expand All @@ -124,7 +125,10 @@ impl SBTarget {
})
}
pub fn breakpoint_create_for_exception(
&self, language: LanguageType, catch_bp: bool, throw_bp: bool,
&self,
language: LanguageType,
catch_bp: bool,
throw_bp: bool,
) -> SBBreakpoint {
cpp!(unsafe [self as "SBTarget*", language as "lldb::LanguageType", catch_bp as "bool", throw_bp as "bool"] -> SBBreakpoint as "SBBreakpoint" {
return self->BreakpointCreateForException(language, catch_bp, throw_bp);
Expand Down
3 changes: 2 additions & 1 deletion adapter2/src/debug_session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,8 @@ impl DebugSession {
err
)),
})
}.right_future()
}
.right_future()
}

fn configure_stdio(&mut self, args: &LaunchRequestArguments, launch_info: &mut SBLaunchInfo) -> Result<(), Error> {
Expand Down
5 changes: 4 additions & 1 deletion adapter2/src/disassembly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ impl AddressSpace {
}

fn add(
&mut self, start_addr: SBAddress, end_addr: SBAddress, instructions: SBInstructionList,
&mut self,
start_addr: SBAddress,
end_addr: SBAddress,
instructions: SBInstructionList,
) -> Rc<DisassembledRange> {
let handle = Handle::new((self.by_handle.len() + 1000) as u32).unwrap();
let instruction_addrs = instructions.iter().map(|i| i.address().load_address(&self.target)).collect();
Expand Down
6 changes: 2 additions & 4 deletions adapter2/src/wire_protocol.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use bytes::BytesMut;
use log::{debug, error, info};
use std::fmt::Write;
use std::str;
use std::io;
use std::str;
use tokio_util::codec;

use crate::debug_protocol::ProtocolMessage;
Expand Down Expand Up @@ -59,9 +59,7 @@ impl codec::Decoder for Codec {

debug!("--> {}", str::from_utf8(&message_bytes).unwrap());
match serde_json::from_slice(&message_bytes) {
Ok(message) => {
return Ok(Some(message))
}
Ok(message) => return Ok(Some(message)),
Err(err) => {
error!("Could not deserialize: {}", err);
return Err(io::Error::new(io::ErrorKind::InvalidData, Box::new(err)));
Expand Down
1 change: 0 additions & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
max_width = 120
fn_args_density = "Compressed"
use_small_heuristics = "Off"

0 comments on commit b101dc3

Please sign in to comment.