1
0
Fork 0

Let rustfmt handle string wrapping

This commit is contained in:
Robbert van der Helm 2022-07-03 16:52:38 +02:00
parent ed880f5297
commit c91b74355f
12 changed files with 67 additions and 26 deletions

1
.rustfmt.toml Normal file
View file

@ -0,0 +1 @@
format_strings = true

View file

@ -50,7 +50,8 @@ pub fn derive_enum(input: TokenStream) -> TokenStream {
_ => {
return syn::Error::new(
attr.span(),
"The name attribute should be a key-value pair with a string argument: #[name = \"foo bar\"]",
"The name attribute should be a key-value pair with a string \
argument: #[name = \"foo bar\"]",
)
.to_compile_error()
.into()
@ -73,7 +74,8 @@ pub fn derive_enum(input: TokenStream) -> TokenStream {
_ => {
return syn::Error::new(
attr.span(),
"The id attribute should be a key-value pair with a string argument: #[id = \"foo-bar\"]",
"The id attribute should be a key-value pair with a string argument: \
#[id = \"foo-bar\"]",
)
.to_compile_error()
.into()

View file

@ -69,7 +69,8 @@ pub fn derive_params(input: TokenStream) -> TokenStream {
_ => {
return syn::Error::new(
attr.span(),
"The id attribute should be a key-value pair with a string argument: #[id = \"foo_bar\"]",
"The id attribute should be a key-value pair with a string argument: \
#[id = \"foo_bar\"]",
)
.to_compile_error()
.into()
@ -92,7 +93,8 @@ pub fn derive_params(input: TokenStream) -> TokenStream {
_ => {
return syn::Error::new(
attr.span(),
"The persist attribute should be a key-value pair with a string argument: #[persist = \"foo_bar\"]",
"The persist attribute should be a key-value pair with a string \
argument: #[persist = \"foo_bar\"]",
)
.to_compile_error()
.into()
@ -110,9 +112,12 @@ pub fn derive_params(input: TokenStream) -> TokenStream {
.to_compile_error()
.into();
} else if s.contains('/') {
return syn::Error::new(attr.span(), "Group names may not contain slashes")
.to_compile_error()
.into();
return syn::Error::new(
attr.span(),
"Group names may not contain slashes",
)
.to_compile_error()
.into();
} else if nested_attr.is_some() {
return syn::Error::new(attr.span(), "Duplicate nested attribute")
.to_compile_error()
@ -124,7 +129,8 @@ pub fn derive_params(input: TokenStream) -> TokenStream {
_ => {
return syn::Error::new(
attr.span(),
"The nested attribute should be a key-value pair with a string argument: #[nested = \"Group Name\"]",
"The nested attribute should be a key-value pair with a string \
argument: #[nested = \"Group Name\"]",
)
.to_compile_error()
.into()

View file

@ -12,7 +12,8 @@ use crate::util::permit_alloc;
/// See [`EventLoop`][super::EventLoop].
#[cfg_attr(
target_os = "macos",
deprecated = "macOS needs to have its own event loop implementation, this implementation may not work correctly"
deprecated = "macOS needs to have its own event loop implementation, this implementation may \
not work correctly"
)]
pub(crate) struct LinuxEventLoop<T, E> {
/// The thing that ends up executing these tasks. The tasks are usually executed from the worker
@ -71,7 +72,10 @@ where
true
}
None => {
nih_trace!("The executor doesn't exist but somehow it's still submitting tasks, this shouldn't be possible!");
nih_trace!(
"The executor doesn't exist but somehow it's still submitting tasks, this \
shouldn't be possible!"
);
false
}
}
@ -112,7 +116,10 @@ where
Ok(Message::Task(task)) => match executor.upgrade() {
Some(e) => unsafe { e.execute(task) },
None => {
nih_trace!("Received a new task but the executor is no longer alive, shutting down worker");
nih_trace!(
"Received a new task but the executor is no longer alive, shutting down \
worker"
);
return;
}
},

View file

@ -141,7 +141,10 @@ where
true
}
None => {
nih_trace!("The executor doesn't exist but somehow it's still submitting tasks, this shouldn't be possible!");
nih_trace!(
"The executor doesn't exist but somehow it's still submitting tasks, this \
shouldn't be possible!"
);
false
}
}

View file

@ -50,7 +50,11 @@ impl<P: ClapPlugin> GuiContext for WrapperGuiContext<P> {
.wrapper
.queue_parameter_event(OutputParamEvent::BeginGesture { param_hash: *hash });
nih_debug_assert!(success, "Parameter output event queue was full, parameter change will not be sent to the host");
nih_debug_assert!(
success,
"Parameter output event queue was full, parameter change will not be sent to \
the host"
);
}
None => nih_debug_assert_failure!("Unknown parameter: {:?}", param),
}
@ -72,7 +76,11 @@ impl<P: ClapPlugin> GuiContext for WrapperGuiContext<P> {
clap_plain_value,
});
nih_debug_assert!(success, "Parameter output event queue was full, parameter change will not be sent to the host");
nih_debug_assert!(
success,
"Parameter output event queue was full, parameter change will not be sent to \
the host"
);
}
None => nih_debug_assert_failure!("Unknown parameter: {:?}", param),
}
@ -85,7 +93,11 @@ impl<P: ClapPlugin> GuiContext for WrapperGuiContext<P> {
.wrapper
.queue_parameter_event(OutputParamEvent::EndGesture { param_hash: *hash });
nih_debug_assert!(success, "Parameter output event queue was full, parameter change will not be sent to the host");
nih_debug_assert!(
success,
"Parameter output event queue was full, parameter change will not be sent to \
the host"
);
}
None => nih_debug_assert_failure!("Unknown parameter: {:?}", param),
}

View file

@ -391,8 +391,8 @@ impl<P: ClapPlugin> Wrapper<P> {
nih_debug_assert_eq!(
param_map.len(),
param_ids.len(),
"The plugin has duplicate parameter IDs, weird things may happen. \
Consider using 6 character parameter IDs to avoid collissions.."
"The plugin has duplicate parameter IDs, weird things may happen. Consider using \
6 character parameter IDs to avoid collissions.."
);
let mut bypass_param_exists = false;

View file

@ -115,7 +115,12 @@ fn run_wrapper<P: Plugin, B: Backend>(backend: B, config: WrapperConfig) -> bool
fn print_error(error: WrapperError, config: &WrapperConfig) {
match error {
WrapperError::IncompatibleConfig => {
nih_error!("The plugin does not support the {} channel input and {} channel output configuration", config.input_channels, config.output_channels);
nih_error!(
"The plugin does not support the {} channel input and {} channel output \
configuration",
config.input_channels,
config.output_channels
);
}
WrapperError::InitializationFailed => {
nih_error!("The plugin failed to initialize");

View file

@ -64,7 +64,10 @@ impl Backend for Jack {
// buffers like that so we'll just make it easier for ourselves by not supporting that
let num_frames = ps.n_frames();
if num_frames != buffer_size {
nih_error!("Buffer size changed from {buffer_size} to {num_frames}. Buffer size changes are currently not supported, aborting...");
nih_error!(
"Buffer size changed from {buffer_size} to {num_frames}. Buffer size changes \
are currently not supported, aborting..."
);
control_sender.send(Task::Shutdown).unwrap();
return Control::Quit;
}

View file

@ -142,8 +142,8 @@ impl<P: Plugin, B: Backend> Wrapper<P, B> {
nih_debug_assert_eq!(
param_map.len(),
param_ids.len(),
"The plugin has duplicate parameter IDs, weird things may happen. \
Consider using 6 character parameter IDs to avoid collissions.."
"The plugin has duplicate parameter IDs, weird things may happen. Consider using \
6 character parameter IDs to avoid collissions.."
);
let mut bypass_param_exists = false;

View file

@ -220,8 +220,8 @@ impl<P: Vst3Plugin> WrapperInner<P> {
nih_debug_assert_eq!(
param_map.len(),
param_ids.len(),
"The plugin has duplicate parameter IDs, weird things may happen. \
Consider using 6 character parameter IDs to avoid collissions.."
"The plugin has duplicate parameter IDs, weird things may happen. Consider using \
6 character parameter IDs to avoid collissions.."
);
let mut bypass_param_exists = false;
@ -241,7 +241,9 @@ impl<P: Vst3Plugin> WrapperInner<P> {
&& (VST3_MIDI_PARAMS_START..VST3_MIDI_PARAMS_END).contains(hash)
{
nih_debug_assert_failure!(
"Parameter '{}' collides with an automatically generated MIDI CC parameter, consider giving it a different ID", id
"Parameter '{}' collides with an automatically generated MIDI CC \
parameter, consider giving it a different ID",
id
);
}
}

View file

@ -519,8 +519,8 @@ impl<P: Vst3Plugin> Drop for RunLoopEventHandler<P> {
if posting_failed {
nih_debug_assert_failure!(
"Outstanding tasks have been dropped when clsoing \
the editor as the task queue was full"
"Outstanding tasks have been dropped when clsoing the editor as the task queue \
was full"
);
}