Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
thebino committed Jul 4, 2023
1 parent 0756b14 commit bd83eeb
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 24 deletions.
2 changes: 0 additions & 2 deletions crates/core_activity_pub/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

use activitypub_federation::config::{Data, UrlVerifier};
2 changes: 1 addition & 1 deletion crates/core_common/src/model/sensitive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl<T> Sensitive<T> {
}
}

///! overrides the standard debug programmer-facing representation to prevent the value from leaking.
// overrides the standard debug programmer-facing representation to prevent the value from leaking.
impl<T> std::fmt::Debug for Sensitive<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("[********]").finish()
Expand Down
1 change: 1 addition & 0 deletions crates/core_photos/src/data/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

#[allow(dead_code)]
enum DataAccessError {
NotFound,
#[allow(dead_code)]
Expand Down
6 changes: 3 additions & 3 deletions crates/plugin_interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ pub trait Plugin {
///
#[repr(C)]
#[derive(StableAbi)]
#[sabi(kind(Prefix(prefix_ref = PluginFactory_Ref)))]
#[sabi(kind(Prefix(prefix_ref = PluginFactoryRef)))]
#[sabi(missing_field(panic))]
pub struct PluginFactory {
/// Constructs the plugin.
#[sabi(last_prefix_field)]
pub new: extern "C" fn(RSender<PluginCommand>, PluginId) -> RResult<PluginType, Error>,
}

impl RootModule for PluginFactory_Ref {
declare_root_module_statics! {PluginFactory_Ref}
impl RootModule for PluginFactoryRef {
declare_root_module_statics! {PluginFactoryRef}
const BASE_NAME: &'static str = "plugin";
const NAME: &'static str = "plugin";
const VERSION_STRINGS: VersionStrings = package_version_strings!();
Expand Down
16 changes: 5 additions & 11 deletions src/api/authentication/requests/authorization_requests.rs
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
use abi_stable::std_types::string;

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

use axum::{
extract::{FromRef, Query, State},
http::{
header::{self, HeaderMap, HeaderName},
StatusCode, Uri,
header::{self},
StatusCode,
},
response::IntoResponse,
routing::{get, post},
Json, Router,
Json,
};
use oxide_auth_axum::{OAuthRequest, OAuthResponse, WebError};

#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Serialize)]
pub struct Error {
message: String,
}

///!
/// Authorization Request
/// See 4.1.1: https://tools.ietf.org/html/rfc6749#section-4.1.1
///
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use abi_stable::std_types::RResult::{RErr, ROk};
use anyhow::Result;
use axum::routing::{get, head};
use axum::{Json, Router};
use photos_network_plugin::{PluginFactory_Ref, PluginId};
use photos_network_plugin::{PluginFactoryRef, PluginId};
use serde::{Deserialize, Serialize};
use tower_http::services::ServeDir;
use tower_http::trace::TraceLayer;
Expand Down Expand Up @@ -148,7 +148,7 @@ pub async fn start_server() -> Result<()> {

pub struct ApplicationState {
pub config: Configuration,
pub plugins: HashMap<PluginId, PluginFactory_Ref>,
pub plugins: HashMap<PluginId, PluginFactoryRef>,
pub router: Option<Router>,
}

Expand Down
9 changes: 4 additions & 5 deletions src/plugin/plugin_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use anyhow::Result;

use crate::{config::configuration::Configuration, ApplicationState};
use core_extensions::SelfOps;
use photos_network_plugin::{PluginFactory_Ref, PluginId};
use photos_network_plugin::{PluginFactoryRef, PluginId};
use tracing::{debug, error, info};

pub struct PluginManager<'a> {
Expand Down Expand Up @@ -73,7 +73,7 @@ impl<'a> PluginManager<'a> {

debug!("Try to load plugin '{}'...", plugin_name);
let header = lib_header_from_path(&plugin_path)?;
let res = header.init_root_module::<PluginFactory_Ref>();
let res = header.init_root_module::<PluginFactoryRef>();

let root_module = match res {
Ok(x) => x,
Expand All @@ -83,8 +83,7 @@ impl<'a> PluginManager<'a> {
}
};

let mut loaded_libraries = Vec::<PluginId>::new();
loaded_libraries.push(PluginId::from(plugin_name.clone()));
let mut _loaded_libraries = vec![PluginId::from(plugin_name.clone())];

// TODO: insert loaded plugin instead?
self.state
Expand All @@ -96,7 +95,7 @@ impl<'a> PluginManager<'a> {
Ok(())
}

pub async fn trigger_on_init(&mut self) -> () {
pub async fn trigger_on_init(&mut self) {
// self.state.router.as_mut().unwrap().route("/foo", get( || async { "It's working!" } ));
// ERROR: move occurs because value has type `Router`, which does not implement the `Copy` trait
}
Expand Down

0 comments on commit bd83eeb

Please sign in to comment.