refactor: clean up unused binding and simplify Mutex patterns
- plugin_loader.rs: remove unused _plugin_id binding in discover_plugins - http/mod.rs: simplify config() and player_status() Mutex access patterns
This commit is contained in:
@@ -146,11 +146,11 @@ impl PluginLoader {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 跳过非插件文件(如 registry.json)
|
// Skip non-plugin entries (e.g. registry.json)
|
||||||
let _plugin_id = match path.file_name().and_then(|n| n.to_str()) {
|
match path.file_name().and_then(|n| n.to_str()) {
|
||||||
Some(name) if name != "registry.json" => name.to_string(),
|
Some(name) if name != "registry.json" => {}
|
||||||
_ => continue,
|
_ => continue,
|
||||||
};
|
}
|
||||||
|
|
||||||
// 扫描版本子目录
|
// 扫描版本子目录
|
||||||
for version_entry in std::fs::read_dir(&path)? {
|
for version_entry in std::fs::read_dir(&path)? {
|
||||||
|
|||||||
@@ -100,10 +100,12 @@ impl HttpState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn config(&self) -> Arc<AppConfig> {
|
pub(crate) fn config(&self) -> Arc<AppConfig> {
|
||||||
self.config
|
Arc::clone(
|
||||||
.lock()
|
&self
|
||||||
.map(|config| Arc::clone(&config))
|
.config
|
||||||
.expect("http config state poisoned")
|
.lock()
|
||||||
|
.expect("http config state poisoned"),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn replace_config(&self, config: Arc<AppConfig>) {
|
fn replace_config(&self, config: Arc<AppConfig>) {
|
||||||
@@ -122,8 +124,8 @@ impl HttpState {
|
|||||||
pub(crate) fn player_status(&self) -> crate::core::message::PlayerStatusData {
|
pub(crate) fn player_status(&self) -> crate::core::message::PlayerStatusData {
|
||||||
self.player_status
|
self.player_status
|
||||||
.lock()
|
.lock()
|
||||||
.map(|status| status.clone())
|
|
||||||
.expect("http player status state poisoned")
|
.expect("http player status state poisoned")
|
||||||
|
.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_player_status(&self, status: crate::core::message::PlayerStatusData) {
|
fn update_player_status(&self, status: crate::core::message::PlayerStatusData) {
|
||||||
|
|||||||
Reference in New Issue
Block a user