Skip to content

Commit

Permalink
Clean up deprecations and FIXMEs
Browse files Browse the repository at this point in the history
  • Loading branch information
sfackler committed Jan 22, 2025
1 parent 158d322 commit 0f77705
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 62 deletions.
17 changes: 0 additions & 17 deletions conjure-codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
//!
//! println!("cargo:rerun-if-changed={}", input);
//! conjure_codegen::Config::new()
//! .run_rustfmt(false)
//! .strip_prefix("com.foobar.service".to_string())
//! .generate_files(input, output)
//! .unwrap();
Expand Down Expand Up @@ -294,7 +293,6 @@ use proc_macro2::TokenStream;
use quote::quote;
use std::collections::BTreeMap;
use std::env;
use std::ffi::OsStr;
use std::fs;
use std::path::Path;

Expand Down Expand Up @@ -361,21 +359,6 @@ impl Config {
self
}

/// No longer used.
#[deprecated(note = "no longer used", since = "1.2.0")]
pub fn run_rustfmt(&mut self, _run_rustfmt: bool) -> &mut Config {
self
}

/// No longer used.
#[deprecated(note = "no longer used", since = "1.2.0")]
pub fn rustfmt<T>(&mut self, _rustfmt: T) -> &mut Config
where
T: AsRef<OsStr>,
{
self
}

/// Sets a prefix that will be stripped from package names.
///
/// Defaults to `None`.
Expand Down
8 changes: 0 additions & 8 deletions conjure-http/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ use std::sync::Arc;

pub mod conjure;

#[allow(missing_docs)]
#[deprecated(note = "renamed to RequestBody", since = "3.5.0")]
pub type Body<'a, T> = RequestBody<'a, T>;

#[allow(missing_docs)]
#[deprecated(note = "renamed to AsyncRequestBody", since = "3.5.0")]
pub type AsyncBody<'a, T> = AsyncRequestBody<'a, T>;

/// A trait implemented by generated blocking client interfaces for a Conjure service.
pub trait Service<C> {
/// Creates a new service wrapping an HTTP client.
Expand Down
38 changes: 3 additions & 35 deletions conjure-http/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use std::future::Future;
use std::io::Write;
use std::iter::FromIterator;
use std::marker::PhantomData;
use std::ops::Deref;
use std::pin::Pin;
use std::str;
use std::str::FromStr;
Expand Down Expand Up @@ -405,30 +404,16 @@ where
/// Conjure service endpoints declared with the `server-request-context` tag will be passed a
/// `RequestContext` in the generated trait.
pub struct RequestContext<'a> {
request_parts: MaybeBorrowed<'a, request::Parts>,
request_parts: &'a request::Parts,
response_extensions: &'a mut Extensions,
}

impl<'a> RequestContext<'a> {
// This is public API but not exposed in docs since it should only be called by generated code.
#[doc(hidden)]
#[inline]
// FIXME remove in favor of borrowed constructor
pub fn new(request_parts: request::Parts, response_extensions: &'a mut Extensions) -> Self {
pub fn new(request_parts: &'a request::Parts, response_extensions: &'a mut Extensions) -> Self {
RequestContext {
request_parts: MaybeBorrowed::Owned(request_parts),
response_extensions,
}
}

#[doc(hidden)]
#[inline]
pub fn new2(
request_parts: &'a request::Parts,
response_extensions: &'a mut Extensions,
) -> Self {
RequestContext {
request_parts: MaybeBorrowed::Borrowed(request_parts),
request_parts,
response_extensions,
}
}
Expand Down Expand Up @@ -464,23 +449,6 @@ impl<'a> RequestContext<'a> {
}
}

enum MaybeBorrowed<'a, T> {
Borrowed(&'a T),
Owned(T),
}

impl<T> Deref for MaybeBorrowed<'_, T> {
type Target = T;

#[inline]
fn deref(&self) -> &Self::Target {
match self {
MaybeBorrowed::Borrowed(v) => v,
MaybeBorrowed::Owned(v) => v,
}
}
}

/// A trait implemented by request body deserializers used by custom Conjure server trait
/// implementations.
pub trait DeserializeRequest<T, R> {
Expand Down
2 changes: 1 addition & 1 deletion conjure-macros/src/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ fn generate_context_arg(
) -> TokenStream {
let name = &arg.ident;
quote! {
let #name = conjure_http::server::RequestContext::new2(&#parts, #response_extensions);
let #name = conjure_http::server::RequestContext::new(&#parts, #response_extensions);
}
}

Expand Down
2 changes: 1 addition & 1 deletion conjure-object/src/private.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ where
}

// FIXME make private in 5.0
pub fn valid_enum_variant(s: &str) -> bool {
fn valid_enum_variant(s: &str) -> bool {
if s.is_empty() {
return false;
}
Expand Down

0 comments on commit 0f77705

Please sign in to comment.