fix: one must imagine clippy happy

This commit is contained in:
Ilya K 2024-11-16 17:53:22 +03:00
parent 0af623a929
commit f40ac345fc
20 changed files with 92 additions and 101 deletions

View file

@ -63,7 +63,7 @@ impl MetricType {
let fields: Vec<String> = event let fields: Vec<String> = event
.fields .fields
.iter() .iter()
.map(|&(ref _fieldname, ref fieldtype)| fieldtype.clone()) .map(|(_fieldname, fieldtype)| fieldtype.clone())
.collect(); .collect();
fields fields
@ -94,7 +94,7 @@ impl MetricType {
let fields: Vec<String> = event let fields: Vec<String> = event
.fields .fields
.iter() .iter()
.map(|&(ref fieldname, ref _fieldtype)| fieldname.clone()) .map(|(fieldname, _fieldtype)| fieldname.clone())
.collect(); .collect();
fields fields
@ -139,7 +139,7 @@ fn name_to_parts(name: &str) -> Vec<String> {
parts.push(buf.to_owned()); parts.push(buf.to_owned());
buf = String::from(""); buf = String::from("");
} }
buf.push_str(&c.to_string()); buf.push(c);
} }
if !buf.is_empty() { if !buf.is_empty() {
parts.push(buf.to_owned()); parts.push(buf.to_owned());

View file

@ -215,7 +215,7 @@ mod tests {
let lines: Vec<String> = spawned.lines().collect(); let lines: Vec<String> = spawned.lines().collect();
assert_eq!(lines, vec!["hi"]); assert_eq!(lines, vec!["hi"]);
let ret = spawned.wait().unwrap().success(); let ret = spawned.wait().unwrap().success();
assert_eq!(true, ret); assert!(ret);
} }
#[test] #[test]
@ -235,7 +235,7 @@ mod tests {
let lines: Vec<String> = spawned.lines().collect(); let lines: Vec<String> = spawned.lines().collect();
assert_eq!(lines, vec!["stdout", "stderr", "stdout2", "stderr2"]); assert_eq!(lines, vec!["stdout", "stderr", "stdout2", "stderr2"]);
let ret = spawned.wait().unwrap().success(); let ret = spawned.wait().unwrap().success();
assert_eq!(true, ret); assert!(ret);
} }
#[test] #[test]
@ -250,7 +250,7 @@ mod tests {
assert_eq!(lines.len(), 20000); assert_eq!(lines.len(), 20000);
let thread_result = spawned.wait(); let thread_result = spawned.wait();
let exit_status = thread_result.expect("Thread should exit correctly"); let exit_status = thread_result.expect("Thread should exit correctly");
assert_eq!(true, exit_status.success()); assert!(exit_status.success());
} }
#[test] #[test]
@ -265,7 +265,7 @@ mod tests {
assert_eq!(lines.len(), 200000); assert_eq!(lines.len(), 200000);
let thread_result = spawned.wait(); let thread_result = spawned.wait();
let exit_status = thread_result.expect("Thread should exit correctly"); let exit_status = thread_result.expect("Thread should exit correctly");
assert_eq!(true, exit_status.success()); assert!(exit_status.success());
} }
#[test] #[test]
@ -286,6 +286,6 @@ mod tests {
vec!["hi", "Non-UTF8 data omitted from the log.", "there"] vec!["hi", "Non-UTF8 data omitted from the log.", "there"]
); );
let ret = spawned.wait().unwrap().success(); let ret = spawned.wait().unwrap().success();
assert_eq!(true, ret); assert!(ret);
} }
} }

View file

@ -102,13 +102,13 @@ impl<'a> Publisher<'a> {
} }
} }
fn publish_serde_action<T: ?Sized>( fn publish_serde_action<T>(
&mut self, &mut self,
exchange: Option<String>, exchange: Option<String>,
routing_key: Option<String>, routing_key: Option<String>,
msg: &T, msg: &T,
) where ) where
T: Serialize, T: Serialize + ?Sized,
{ {
self.recv self.recv
.tell(worker::publish_serde_action(exchange, routing_key, msg)); .tell(worker::publish_serde_action(exchange, routing_key, msg));

View file

@ -39,7 +39,7 @@ impl CachedCloner {
let mut new_root = self.root.clone(); let mut new_root = self.root.clone();
new_root.push("repo"); new_root.push("repo");
new_root.push(format!("{:x}", md5::compute(&name))); new_root.push(format!("{:x}", md5::compute(name)));
CachedProject { CachedProject {
root: new_root, root: new_root,

View file

@ -67,8 +67,8 @@ pub trait GitClonable {
let result = Command::new("git") let result = Command::new("git")
.arg("clone") .arg("clone")
.args(self.extra_clone_args()) .args(self.extra_clone_args())
.arg(&self.clone_from()) .arg(self.clone_from())
.arg(&self.clone_to()) .arg(self.clone_to())
.stdout(Stdio::null()) .stdout(Stdio::null())
.status()?; .status()?;

View file

@ -118,7 +118,7 @@ impl ChannelExt for Channel {
let mut consumer = self let mut consumer = self
.basic_consume( .basic_consume(
"amq.rabbitmq.reply-to".into(), "amq.rabbitmq.reply-to",
"whoami", "whoami",
BasicConsumeOptions::default(), BasicConsumeOptions::default(),
FieldTable::default(), FieldTable::default(),

View file

@ -79,9 +79,7 @@ impl ImpactedMaintainers {
} }
pub fn maintainers(&self) -> Vec<String> { pub fn maintainers(&self) -> Vec<String> {
self.0 self.0.keys().map(|maintainer| maintainer.0.clone())
.iter()
.map(|(maintainer, _)| maintainer.0.clone())
.collect() .collect()
} }
@ -93,7 +91,7 @@ impl ImpactedMaintainers {
bypkg bypkg
.0 .0
.entry(package.clone()) .entry(package.clone())
.or_insert_with(HashSet::new) .or_default()
.insert(maintainer.clone()); .insert(maintainer.clone());
} }
} }

View file

@ -56,7 +56,7 @@ impl Operation {
fn args(&self, command: &mut Command) { fn args(&self, command: &mut Command) {
match *self { match *self {
Operation::Build => { Operation::Build => {
command.args(&[ command.args([
"--no-out-link", "--no-out-link",
"--keep-going", "--keep-going",
"--option", "--option",
@ -65,7 +65,7 @@ impl Operation {
]); ]);
} }
Operation::QueryPackagesJson => { Operation::QueryPackagesJson => {
command.args(&[ command.args([
"--query", "--query",
"--available", "--available",
"--json", "--json",
@ -75,7 +75,7 @@ impl Operation {
]); ]);
} }
Operation::QueryPackagesOutputs => { Operation::QueryPackagesOutputs => {
command.args(&[ command.args([
"--query", "--query",
"--available", "--available",
"--no-name", "--no-name",
@ -90,7 +90,7 @@ impl Operation {
operation.args(command); operation.args(command);
} }
Operation::Evaluate => { Operation::Evaluate => {
command.args(&[ command.args([
"--eval", "--eval",
"--strict", "--strict",
"--json", "--json",
@ -100,7 +100,7 @@ impl Operation {
]); ]);
} }
Operation::Instantiate => { Operation::Instantiate => {
command.args(&["--option", "extra-experimental-features", "no-url-literals"]); command.args(["--option", "extra-experimental-features", "no-url-literals"]);
} }
_ => (), _ => (),
}; };
@ -343,23 +343,23 @@ impl Nix {
command.env("NIX_REMOTE", &self.remote); command.env("NIX_REMOTE", &self.remote);
if let Some(ref initial_heap_size) = self.initial_heap_size { if let Some(ref initial_heap_size) = self.initial_heap_size {
command.env("GC_INITIAL_HEAP_SIZE", &initial_heap_size); command.env("GC_INITIAL_HEAP_SIZE", initial_heap_size);
} }
let path = env::var("PATH").unwrap(); let path = env::var("PATH").unwrap();
command.env("PATH", path); command.env("PATH", path);
command.args(&["--show-trace"]); command.args(["--show-trace"]);
command.args(&["--option", "restrict-eval", "true"]); command.args(["--option", "restrict-eval", "true"]);
command.args(&[ command.args([
"--option", "--option",
"build-timeout", "build-timeout",
&format!("{}", self.build_timeout), &format!("{}", self.build_timeout),
]); ]);
command.args(&["--argstr", "system", &self.system]); command.args(["--argstr", "system", &self.system]);
if self.limit_supported_systems { if self.limit_supported_systems {
command.args(&[ command.args([
"--arg", "--arg",
"supportedSystems", "supportedSystems",
&format!("[\"{}\"]", &self.system), &format!("[\"{}\"]", &self.system),
@ -374,7 +374,7 @@ impl Nix {
fn lines_from_file(file: fs::File) -> Vec<String> { fn lines_from_file(file: fs::File) -> Vec<String> {
BufReader::new(file) BufReader::new(file)
.lines() .lines()
.filter_map(|line| line.ok()) .map_while(Result::ok)
.filter(|msg| !is_user_setting_warning(msg)) .filter(|msg| !is_user_setting_warning(msg))
.collect() .collect()
} }
@ -456,8 +456,7 @@ mod tests {
fn strip_ansi(string: &str) -> String { fn strip_ansi(string: &str) -> String {
string string
.replace('', "'") .replace(['', ''], "'")
.replace('', "'")
.replace("\u{1b}[31;1m", "") // red .replace("\u{1b}[31;1m", "") // red
.replace("\u{1b}[0m", "") // reset .replace("\u{1b}[0m", "") // reset
} }

View file

@ -314,14 +314,12 @@ mod tests {
impl From<PackageArchSrc> for Vec<PackageArch> { impl From<PackageArchSrc> for Vec<PackageArch> {
fn from(src: PackageArchSrc) -> Vec<PackageArch> { fn from(src: PackageArchSrc) -> Vec<PackageArch> {
let darwin: Vec<PackageArch> = (0..src.darwin) let darwin: Vec<PackageArch> = (0..src.darwin)
.into_iter()
.map(|_| PackageArch { .map(|_| PackageArch {
package: String::from("bogus :)"), package: String::from("bogus :)"),
architecture: String::from("x86_64-darwin"), architecture: String::from("x86_64-darwin"),
}) })
.collect(); .collect();
let linux: Vec<PackageArch> = (0..src.linux) let linux: Vec<PackageArch> = (0..src.linux)
.into_iter()
.map(|_| PackageArch { .map(|_| PackageArch {
package: String::from("bogus :)"), package: String::from("bogus :)"),
architecture: String::from("x86_64-linux"), architecture: String::from("x86_64-linux"),

View file

@ -447,8 +447,7 @@ mod tests {
fn strip_escaped_ansi(string: &str) -> String { fn strip_escaped_ansi(string: &str) -> String {
string string
.replace('', "'") .replace(['', ''], "'")
.replace('', "'")
.replace("\\u001b[31;1m", "") // red .replace("\\u001b[31;1m", "") // red
.replace("\\u001b[0m", "") // reset .replace("\\u001b[0m", "") // reset
} }

View file

@ -124,7 +124,7 @@ impl<'a> NixpkgsStrategy<'a> {
if impacted_maintainers.maintainers().len() < 10 { if impacted_maintainers.maintainers().len() < 10 {
let existing_reviewers = block_on( let existing_reviewers = block_on(
self.vcs_api self.vcs_api
.get_existing_reviewers(&self.repo, self.change.number), .get_existing_reviewers(self.repo, self.change.number),
); );
// Normalize both sides, compute the IM - ER set // Normalize both sides, compute the IM - ER set

View file

@ -124,7 +124,7 @@ mod tests {
#[test] #[test]
fn stdenv_checking() { fn stdenv_checking() {
let output = Command::new("nix-instantiate") let output = Command::new("nix-instantiate")
.args(&["--eval", "-E", "<nixpkgs>"]) .args(["--eval", "-E", "<nixpkgs>"])
.output() .output()
.expect("nix-instantiate required"); .expect("nix-instantiate required");

View file

@ -50,7 +50,7 @@ impl worker::SimpleWorker for GitHubCommentWorker {
} }
let instructions = commentparser::parse(&job.comment.body); let instructions = commentparser::parse(&job.comment.body);
if instructions == None { if instructions.is_none() {
return vec![worker::Action::Ack]; return vec![worker::Action::Ack];
} }

View file

@ -241,7 +241,7 @@ mod tests {
attrs: vec!["foo".to_owned(), "bar".to_owned()], attrs: vec!["foo".to_owned(), "bar".to_owned()],
}; };
let timestamp = Utc.ymd(2023, 4, 20).and_hms(13, 37, 42); let timestamp = Utc.with_ymd_and_hms(2023, 4, 20, 13, 37, 42).unwrap();
assert_eq!( assert_eq!(
job_to_check(&job, "x86_64-linux", timestamp), job_to_check(&job, "x86_64-linux", timestamp),
CheckRunOptions { CheckRunOptions {
@ -293,7 +293,7 @@ mod tests {
status: BuildStatus::Success, status: BuildStatus::Success,
}; };
let timestamp = Utc.ymd(2023, 4, 20).and_hms(13, 37, 42); let timestamp = Utc.with_ymd_and_hms(2023, 4, 20, 13, 37, 42).unwrap();
assert_eq!( assert_eq!(
result_to_check(&result, timestamp), result_to_check(&result, timestamp),
@ -375,7 +375,7 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29
status: BuildStatus::Failure, status: BuildStatus::Failure,
}; };
let timestamp = Utc.ymd(2023, 4, 20).and_hms(13, 37, 42); let timestamp = Utc.with_ymd_and_hms(2023, 4, 20, 13, 37, 42).unwrap();
assert_eq!( assert_eq!(
result_to_check(&result, timestamp), result_to_check(&result, timestamp),
@ -454,7 +454,7 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29
status: BuildStatus::TimedOut, status: BuildStatus::TimedOut,
}; };
let timestamp = Utc.ymd(2023, 4, 20).and_hms(13, 37, 42); let timestamp = Utc.with_ymd_and_hms(2023, 4, 20, 13, 37, 42).unwrap();
assert_eq!( assert_eq!(
result_to_check(&result, timestamp), result_to_check(&result, timestamp),
@ -534,7 +534,7 @@ error: build of '/nix/store/l1limh50lx2cx45yb2gqpv7k8xl1mik2-gdb-8.1.drv' failed
status: BuildStatus::Success, status: BuildStatus::Success,
}; };
let timestamp = Utc.ymd(2023, 4, 20).and_hms(13, 37, 42); let timestamp = Utc.with_ymd_and_hms(2023, 4, 20, 13, 37, 42).unwrap();
assert_eq!( assert_eq!(
result_to_check(&result, timestamp), result_to_check(&result, timestamp),
@ -612,7 +612,7 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29
status: BuildStatus::Failure, status: BuildStatus::Failure,
}; };
let timestamp = Utc.ymd(2023, 4, 20).and_hms(13, 37, 42); let timestamp = Utc.with_ymd_and_hms(2023, 4, 20, 13, 37, 42).unwrap();
assert_eq!( assert_eq!(
result_to_check(&result, timestamp), result_to_check(&result, timestamp),
@ -679,7 +679,7 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29
status: BuildStatus::Skipped, status: BuildStatus::Skipped,
}; };
let timestamp = Utc.ymd(2023, 4, 20).and_hms(13, 37, 42); let timestamp = Utc.with_ymd_and_hms(2023, 4, 20, 13, 37, 42).unwrap();
assert_eq!( assert_eq!(
result_to_check(&result, timestamp), result_to_check(&result, timestamp),
@ -732,7 +732,7 @@ foo
status: BuildStatus::Skipped, status: BuildStatus::Skipped,
}; };
let timestamp = Utc.ymd(2023, 4, 20).and_hms(13, 37, 42); let timestamp = Utc.with_ymd_and_hms(2023, 4, 20, 13, 37, 42).unwrap();
assert_eq!( assert_eq!(
result_to_check(&result, timestamp), result_to_check(&result, timestamp),

View file

@ -155,9 +155,8 @@ impl LogMessageCollector {
let attempt = OpenOptions::new() let attempt = OpenOptions::new()
.append(true) .append(true)
.read(true) .read(true)
.write(true)
.create(true) .create(true)
.open(&path); .open(path);
match attempt { match attempt {
Ok(handle) => Ok(handle), Ok(handle) => Ok(handle),

View file

@ -51,8 +51,10 @@ impl worker::SimpleWorker for PastebinCollector {
let span = debug_span!("pastebin", title = ?job.title); let span = debug_span!("pastebin", title = ?job.title);
let _enter = span.enter(); let _enter = span.enter();
let mut cfg = jfs::Config::default(); let cfg = jfs::Config {
cfg.single = true; single: true,
..jfs::Config::default()
};
let db = jfs::Store::new_with_cfg(&self.db_path, cfg); let db = jfs::Store::new_with_cfg(&self.db_path, cfg);
if db.is_err() { if db.is_err() {
warn!("could not open database: {:?}", db); warn!("could not open database: {:?}", db);

View file

@ -14,7 +14,7 @@ impl TestScratch {
root: Path::new(env!("CARGO_MANIFEST_DIR")) root: Path::new(env!("CARGO_MANIFEST_DIR"))
.join("test-scratch") .join("test-scratch")
.join("dirs") .join("dirs")
.join(&format!("dir-{}", ident)), .join(format!("dir-{}", ident)),
}; };
TestScratch::create_dir(&scratch); TestScratch::create_dir(&scratch);
@ -27,7 +27,7 @@ impl TestScratch {
root: Path::new(env!("CARGO_MANIFEST_DIR")) root: Path::new(env!("CARGO_MANIFEST_DIR"))
.join("test-scratch") .join("test-scratch")
.join("files") .join("files")
.join(&format!("file-{}", ident)), .join(format!("file-{}", ident)),
}; };
TestScratch::create_dir(&scratch); TestScratch::create_dir(&scratch);

View file

@ -69,7 +69,7 @@ impl VersionControlSystemAPI for GerritHTTPApi {
let repo_name = repo.name.to_owned(); let repo_name = repo.name.to_owned();
async move { async move {
let change_id = self.get_change_id(&repo_name, number).await; let change_id = self.get_change_id(&repo_name, number).await;
GerritHTTPApi::get_change(&self, &change_id) GerritHTTPApi::get_change(self, &change_id)
.await .await
.map(|c| c.into()) .map(|c| c.into())
} }

View file

@ -27,9 +27,9 @@ impl From<BuildStatus> for hubcaps::checks::Conclusion {
} }
} }
impl Into<hubcaps::checks::CheckRunState> for CheckRunState { impl From<CheckRunState> for hubcaps::checks::CheckRunState {
fn into(self) -> hubcaps::checks::CheckRunState { fn from(val: CheckRunState) -> Self {
match self { match val {
CheckRunState::Runnable | CheckRunState::Scheduled => { CheckRunState::Runnable | CheckRunState::Scheduled => {
hubcaps::checks::CheckRunState::Queued hubcaps::checks::CheckRunState::Queued
} }
@ -39,9 +39,9 @@ impl Into<hubcaps::checks::CheckRunState> for CheckRunState {
} }
} }
impl Into<hubcaps::checks::Conclusion> for Conclusion { impl From<Conclusion> for hubcaps::checks::Conclusion {
fn into(self) -> hubcaps::checks::Conclusion { fn from(val: Conclusion) -> Self {
match self { match val {
Conclusion::Skipped => hubcaps::checks::Conclusion::Skipped, Conclusion::Skipped => hubcaps::checks::Conclusion::Skipped,
Conclusion::Success => hubcaps::checks::Conclusion::Success, Conclusion::Success => hubcaps::checks::Conclusion::Success,
Conclusion::Failure => hubcaps::checks::Conclusion::Failure, Conclusion::Failure => hubcaps::checks::Conclusion::Failure,
@ -53,30 +53,30 @@ impl Into<hubcaps::checks::Conclusion> for Conclusion {
} }
} }
impl Into<hubcaps::checks::CheckRunOptions> for CheckRunOptions { impl From<CheckRunOptions> for hubcaps::checks::CheckRunOptions {
fn into(self) -> hubcaps::checks::CheckRunOptions { fn from(val: CheckRunOptions) -> Self {
hubcaps::checks::CheckRunOptions { hubcaps::checks::CheckRunOptions {
name: self.name, name: val.name,
head_sha: self.head_sha, head_sha: val.head_sha,
details_url: self.details_url, details_url: val.details_url,
external_id: self.external_id, external_id: val.external_id,
status: self.status.map(|c| c.into()), status: val.status.map(|c| c.into()),
started_at: self.started_at, started_at: val.started_at,
conclusion: self.conclusion.map(|c| c.into()), conclusion: val.conclusion.map(|c| c.into()),
completed_at: self.completed_at, completed_at: val.completed_at,
output: None, output: None,
actions: None, actions: None,
} }
} }
} }
impl Into<hubcaps::statuses::State> for State { impl From<State> for hubcaps::statuses::State {
fn into(self) -> hubcaps::statuses::State { fn from(val: State) -> Self {
match self { match val {
Self::Pending => hubcaps::statuses::State::Pending, State::Pending => hubcaps::statuses::State::Pending,
Self::Error => hubcaps::statuses::State::Error, State::Error => hubcaps::statuses::State::Error,
Self::Failure => hubcaps::statuses::State::Failure, State::Failure => hubcaps::statuses::State::Failure,
Self::Success => hubcaps::statuses::State::Success, State::Success => hubcaps::statuses::State::Success,
} }
} }
} }
@ -91,26 +91,26 @@ impl GitHubAPI {
} }
} }
impl Into<Repository> for hubcaps::repositories::Repository { impl From<hubcaps::repositories::Repository> for Repository {
fn into(self) -> Repository { fn from(_val: hubcaps::repositories::Repository) -> Self {
Repository {} Repository {}
} }
} }
impl Into<Change> for hubcaps::pulls::Pull { impl From<hubcaps::pulls::Pull> for Change {
fn into(self) -> Change { fn from(val: hubcaps::pulls::Pull) -> Self {
Change { Change {
head_sha: self.head.sha, head_sha: val.head.sha,
number: self.number, number: val.number,
target_branch: Some(self.base.label), target_branch: Some(val.base.label),
} }
} }
} }
impl Into<Account> for hubcaps::users::User { impl From<hubcaps::users::User> for Account {
fn into(self) -> Account { fn from(val: hubcaps::users::User) -> Self {
Account { Account {
username: self.login, username: val.login,
} }
} }
} }
@ -184,7 +184,7 @@ impl VersionControlSystemAPI for GitHubAPI {
change change
.get() .get()
.await .await
.expect(&format!("Failed to obtain change {}", number)) .unwrap_or_else(|_| panic!("Failed to obtain change {}", number))
.into(), .into(),
) )
} }
@ -206,7 +206,7 @@ impl VersionControlSystemAPI for GitHubAPI {
issue issue
.get() .get()
.await .await
.expect(&format!("Failed to obtain issue reference {}", number)), .unwrap_or_else(|_| panic!("Failed to obtain issue reference {}", number)),
)) ))
} }
.boxed() .boxed()
@ -255,16 +255,12 @@ impl VersionControlSystemAPI for GitHubAPI {
label_ref label_ref
.add(to_add.iter().map(|s| s as &str).collect()) .add(to_add.iter().map(|s| s as &str).collect())
.await .await
.expect(&format!( .unwrap_or_else(|_| panic!("Failed to add labels {:?} to issue #{}",
"Failed to add labels {:?} to issue #{}", to_add, issue.number));
to_add, issue.number
));
for label in to_remove { for label in to_remove {
label_ref.remove(&label).await.expect(&format!( label_ref.remove(&label).await.unwrap_or_else(|_| panic!("Failed to remove label {:?} from issue #{}",
"Failed to remove label {:?} from issue #{}", label, issue.number));
label, issue.number
));
} }
} }
.boxed() .boxed()

View file

@ -25,13 +25,13 @@ pub struct QueueMsg {
pub content: Vec<u8>, pub content: Vec<u8>,
} }
pub fn prepare_queue_message<T: ?Sized>( pub fn prepare_queue_message<T>(
exchange: Option<&str>, exchange: Option<&str>,
routing_key: Option<&str>, routing_key: Option<&str>,
msg: &T, msg: &T,
) -> QueueMsg ) -> QueueMsg
where where
T: Serialize, T: Serialize + ?Sized,
{ {
QueueMsg { QueueMsg {
exchange: exchange.map(|s| s.to_owned()), exchange: exchange.map(|s| s.to_owned()),
@ -43,13 +43,13 @@ where
} }
} }
pub fn publish_serde_action<T: ?Sized>( pub fn publish_serde_action<T>(
exchange: Option<String>, exchange: Option<String>,
routing_key: Option<String>, routing_key: Option<String>,
msg: &T, msg: &T,
) -> Action ) -> Action
where where
T: Serialize, T: Serialize + ?Sized,
{ {
Action::Publish(Box::new(prepare_queue_message( Action::Publish(Box::new(prepare_queue_message(
exchange.as_deref(), exchange.as_deref(),